I'm currently working on a directive that will receive arguments from the HTML and use them to fill in the template fields. Here's the code for the directive:
(function(){
angular.module("MyApp",{})
.directive("myDirective",function(){
var MyLink = function(scope,element,attr){
scope.title = attr.title;
}
return{
restrict : 'EA',
transclude:true,
templateUrl:"directive.html",
link:MyLink
}
});
}())
The contents of directive.html are as follows
<div >
<span data-ng-bind="title"></span>
</div>
This is how the main page looks like
<div ng-app="IndexApp" ng-controller="IndexController">
<my-directive title="hello"></my-directive>
this is a test
</div>
However, I'm encountering an issue where the text "hello" is not being displayed. Can anyone help resolve this problem?
You can find a link to the Plunker demo here