Two-Way Binding
Note: ng-shadow is currently broken again, and the API is not stable, don't use this just yet!
Here, we use +name="myName"
(would be ++name="myName"
for a deep watch) to create a two-way binding between $scope.myName
and attrs.name
in the imported component.
- The component is rendered
- Changes on scope are immediately reflected in the component
- Changes to the name attribute in the component are reflected in the component
- Changes to the name attribute in the component are reflected in the scope
Hello, {{myName}}!
One-Way Binding
This way is OK to use!
In this case, the attribute is just passed in as a string. We have one-way binding of strings only through the attribute.
- The component is rendered
- Changes on scope are immediately reflected in the component
- Changes to the name attribute in the component are reflected in the component
- Changes to the name attribute in the component are not reflected in the angular scope
Hello, {{otherName}}!