Tutorial by Examples

Pass in a literal value (not an object), such as a string or number. Child scope gets his own value, if it updates the value, parent scope has his own old value (child scope can't modify the parens scope value). When parent scope value is changed, child scope value will be changed as well. All int...
Passing in a value by reference, you want to share the value between both scopes and manipulate them from both scopes. You should not use {{...}} for interpolation. <two-way text="'Simple text.'" <!-- 'Simple text.' --> simple-value="123" <!-- 123 Note, is...
Pass a method into a directive. It provides a way to execute an expression in the context of the parent scope. Method will be executed in the scope of the parent, you may pass some parameters from the child scope there. You should not use {{...}} for interpolation. When you use & in a directi...
angular.component("SampleComponent", { bindings: { title: '@', movies: '<', reservation: "=", processReservation: "&" } }); Here we have all binding elements. @ indicates that we need a very basic binding, from the parent scope ...
bindings: { mandatory: '=' optional: '=?', foo: '=?bar' } Optional attributes should be marked with question mark: =? or =?bar. It is protection for ($compile:nonassign) exception.

Page 1 of 1