angularjs - Angular JS directive is not working as expected -
i have written simple angularjs custom directive seem missing something. code available at
<!doctype html> <html ng-app="myapp"> <head> <meta charset="utf-8" /> <title>angularjs plunker</title> <script data-require="angular.js@*" data-semver="2.0.0" src="https://code.angularjs.org/2.0.0-beta.6/angular2.min.js"></script> <link rel="stylesheet" href="style.css" /> <script src="menudirective.js"></script> <script src="script.js"></script> </head> <body> <hello-world></hello-world> </body> </html>
directive
(function(){ angular.module('helloworld',[]) .directive('helloworld',helloworld); function helloworld() { return { replace:true, restrict: 'ae', template: '<h3>hello world!!</h3>' } } })();
app
(function() { "use strict" angular.module("myapp",['helloworld']); })();
http://plnkr.co/edit/zywa3bazxzdd5lerydxk
any highly appreciated
you're using wrong version of angular, change included script to:
<script src="https://code.angularjs.org/1.5.7/angular.min.js"></script>
Comments
Post a Comment