AngularJS Developer Guide on Expressions mentions something named $locals
:
It is possible to access the context object using the identifier this and the locals object using the identifier $locals.
I don't understand what "locals object" is and I can't find any more info on $locals in docs. What is it's purpose? How do you operate on it?
See this test describing functionality that came about from Issue 13247.
Also consider this example of a directive with a callback:
The relevant commit where to find more information about it is this one, which also links to the issue asking to introduce $locals.
In short, when passing a parameter to a directive using '&', in order for the directive to be able to execute some code when needed (for example when you use
ng-click="doSomething()"
), the directive can pass information to the caller using local values.For example you can use
ng-click="doSomething($event)"
, where $event is not an attribute of the scope, but a value passed by the ng-click directive.Instead of accessing each "local" value passed by the directive individually, you can have access to all of them at once using
$locals
.More information on how to pass local values from the directive is available in the documentation on directives:
(emphasis mine)
In the above axample, the entire object
{amount: 22}
passed by the directive is available using $locals, and you could thus useincrement($locals.amount)