Problems with ngModel required in policy

0

I have a problem with my directive, it gets a ngModel to insert a value in a text field inside it, but when this model comes with some value it just disappears with it.

Basically I want to pass ngModel to my directive, if there is any value in the model it inserts into the text field, and any modification of the field it modifies in the model.

    
asked by anonymous 14.05.2015 / 16:31

1 answer

1

You do not need a directive to make this happen. AngularJS has a two-way-binding concept. Home When you put ng-model in your text field and declare the variable with the same name in your module, any change you make on one side reflects the other. By default, for each element declared with ng-model in its view, the angle creates a $ scope. $ Watch () for that element that watches over any change in it and reflects on the other side.

    
23.06.2015 / 15:30