Imagine we have a directive named 'foo' with the following configuration:
app.directive('foo', function() {
return {
restrict: 'E',
scope: { prop: '=' },
template: '<h1>{{prop}}</h1>'
};
});
According to Angular's documentation, it is possible to combine one-time binding with two-way binding like this:
<foo prop="::someProperty"></foo>
This setup effectively results in the 'foo' directive not being updated if the value of 'someProperty' changes later on.
Now, let's consider the following code snippet:
<foo ng-repeat="item in items" prop="::item"></foo>
In this scenario, if 'item' gets modified at a later point, the 'foo' directive will be informed, as if there was a regular binding in place. The '::' doesn't seem to have any significant impact (I verified that it prevents an unnecessary watch from being established). To illustrate both cases, I put together this plunker.
My inquiry is: does this behavior adhere to expectations? It appears inconsistent between the two situations.