IttayD
IttayD

Reputation: 29133

AngularJS : undoing changes in ng-repeat

I'm trying to create an edit-in-place directive. What I'm currently stuck with is the ability to cancel edits. I'm trying to copy the model using $parse and then setting it back using assign, but while the elements change, the underlying model does not.

Please find it at http://goo.gl/3ALOQd

Upvotes: 2

Views: 109

Answers (1)

IttayD
IttayD

Reputation: 29133

The reason the code did not work is that $parse(expression).assign($scope, val) will replace the value with mine. In this case, the value is contact which is an object reference to the array of objects in the controller scope. When I set my own value, this replaces the reference with a reference to another object

Upvotes: 1

Related Questions