AngularJS has 3 bindings inside a directive. @, =, and &.
@ attribute string binding
= two way binding
& callback method binding
For @, it is the binding for passing strings. The variables inside the directive's parent scope can pass into the current directive. Using @ looked like the current directive has parameters who was passed by their parent html.
For =, it is the two way model binding, Usually it will be a model which exists both in the current directive's isolated scope and the parent directive's scope. The 2 models are linked together so that any change in one model will be reflected in another model.
For &, it is the methods from the parent scope, so that the current directive can use the method in the parent directive's scope.
https://stackoverflow.com/questions/14050195/what-is-the-difference-between-and-in-directive-scope-in-angularjs
No comments:
Post a Comment