I have a directive myDirective with variable type. If I run I want the directive to use templateUrl: x-template.html.
If I do <
Ok, this might help someone here :-)
To inject your custom attr into your link or controller function use the following.
I'm at work right now but will post a fiddle later if I get a chance :-)
.directive('yourDirective', function() {
return {
restrict: 'EA',
template: '', // or use templateUrl with/without function
scope: {
myAttibute: '@myAttr' // adds myAttribute to the scope
},
link: function(scope) {
console.log(scope.myAttibute);
}
}
}
// HTML ""
// Console will output "foo"