Hi…
Some surprise awaited me when trying to push UI scope binding to the
limits.
Background was to find out to what extend function can be used in template
code rather than direct scope referencing.
Things like {{toQuux(foo)}} rather than {{quuxedFoo}} would be really handy
sometimes to avoid extensive scope mappings.
I noticed that UI updates still take place when the $scope is not involved
besides providing functions.
With some controller code like this
var foo = true; // not a scope variable
//scope has just function references
$scope.toggleFoo = function() { foo = !foo; };
$scope.getFoo = function() { return foo; };
The following template code still updates on button clicks:
<p>{{getFoo()}}</p>
<button ng-click="toggleFoo()">Toggle Foo</button>
This was a surprise to me as there are no scope variables/models can be
watched. Is this something that can be relied on?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.