This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Idea $this in directive locals calls #13247
Closed
Description
It would be nice to have a normalized reference to the locals for directive expression.
I've proposed $this but other candidates could be better ($locals, etc...)
Example
angular.directive("fooBar", function () {
return {
scope: {
ngCallback:"&"
},
compile: function ($scope) {
var ctx = {
foo: "bar"
};
ctx.$this = ctx;// Keep a reference to the locals
$scope.ngCallback(ctx);
}
};
})
Allows to easily dump available locals
<foo-bar ng-callback="log($this)">