Reputation: 4737
AFAIK this is not documented, but I found in angular source a locals
attribute in a directive example:
angular.module('transclude', [])
.directive('pane', function(){
return {
restrict: 'E',
transclude: true,
scope: 'isolate',
locals: { title:'bind' },
template: '<div style="border: 1px solid black;">' +
'<div style="background-color: gray">{{title}}</div>' +
'<div ng-transclude></div>' +
'</div>'
};
});
What does it do? How can I use it?
to be more precise:
How can I access locals
from directive
's controller or link
ing function?
How can I dynamicly change locals
from directive
's controller or link
ing function?
Can I use locals
in every directive, or does it have to be a directive with a transclude=true
?
Upvotes: 4
Views: 2729
Reputation: 4737
I just want to close this question. So the answer is like @ArunPJohny said
@param {Object=} locals
(Optional object).
If preset then any argument names are read from this object first, before the $injector
is consulted
Upvotes: 1
Reputation: 364727
The example code is on the ngTransclude page, inside the script.js
tab.
I believe this is just the older syntax (which still seems to work). The newer syntax would replace
scope: 'isolate',
locals: { title:'bind' },
with
scope: { title: '@' },
Upvotes: 1