My AngularJS directive is not working, can anyone please tell me what's wrong with my code. I have created directives in the past but my code is not working anymore
This is my Plunkr https://plnkr.co/edit/Tf9h4b05bSyueALVSmW8?p=preview
This is correct right?
app.directive('ChartHorizontal', function() {
var directive = {};
directive.restrict = 'E';
directive.template = '<h3>Hello Ji</h3>';
return directive;
});
and in HTML we will do <chart-horizontal></chart-horizontal>
Do we need a controller? If yes, I have already doing it in controller in my project.
Thanks
Works fine in this DEMO:
angular.module("app",[]).directive('chartHorizontal', function() { var directive = {}; directive.restrict = 'E'; directive.template = '<h3>Hello Ji</h3>'; return directive; });
<script src="//unpkg.com/angular/angular.js"></script> <body ng-app="app"> <chart-horizontal></chart-horizontal> </body>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.