angularjs - Change ng-model through directive -


In the I'am instructions, trying to change the NG model of input by clicking on anchor anchor in the instructions template.

The function F () seems to reach the external controller and to bind the name or the editable value to the company so that I can convert it through input

input persons It shows the values ​​of but it does not force it.

  & lt; P edit = "person.name" & gt; & Lt; / P & gt; & Lt; P edit = "person.company" & gt; & Lt; / P & gt; & Lt; Input ng-model = "editable" & gt; Main.controller ('editsCtrl', function ($ scope) {$ scope.setToEdit = function (val) {$ scope.editableValue = val;}}); Main.directive ('edit', function () {return: {{{edit}} & lt; a ng-click = "f ()" & gt; edit & lt; / a & gt; 'restricted': 'A' scope: {Edit: "="}, Replace: wrong, link: function (area, element, etter, CTLL) {scope.f = function} {scope. $ Parent.setToEdit (scope.edit );}}}})  

Even if I do this, it is not tied, just the value is passed:

  radius. $ Parent.editableValue = Scope Person.name;  

For the newbie, it gets a little confusing, what am I missing?

Scope assignment has failed here:

  scope.f = Function () {scope. $ Parent.setToEdit (scope.edit); }  

Because you can limit the area here:

  scope: {edit: "="},  

Edit the parentheses will see only the field because you have set up the database in two ways with '='

.

Comments