I have a problem as I don't understand AngularJS directives 100% yet. I have a directive like so,
in my HTML:
<div my-directive="Hello World"></div>
in my Directive JS file:
.directive('myDirective', [function ( ) {
return {
restrict: 'A',
priority: 100,
templateUrl: 'views/templates/my-directive.html',
link: function (scope, element, attrs) {
// I wish to pass attrs.myDirective to the templateUrl
}
};
}]);
and in my templateUrl 'views/templates/my-directive.html':
<h1> {{ attrs.myDirective }} </h1>
Obviously this does work, my directive value is passed to the link function but not to the templateUrl, how can I output the value in my templateUrl? Silly question I know but I'm not sure what the best way to implement this is?