angularjs - Angular custom directive not working -
i have 2 things do:
- custom directive dropdowns
- custom directive upload
var app=angular.module('app.directives', []);
app.directive('dropdowns', function() {alert("dropdown directive"); return { restrict: 'ae', templateurl: 'html/uploadfile.html' }; }); app.directive('uploaddir', function() { alert("upload directive"); return { restrict : 'ae', templateurl : 'html/dropdowns.html' }; });
the directive dropdown working directive upload not working(the alert message in uploaddir directive not getting displayed)
is syntax correct?
index.html
<!doctype html> <html ng-app="app"> <head> <meta charset="iso-8859-1"> <title>upload using directive</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <script type="text/javascript" src="lib/ui-bootstrap-tpls-0.13.0.js"></script> <link type="text/css" rel="stylesheet" href="css/bootstrap.min.css"/> <script type="text/javascript" src="js/app.js"></script> <script type="text/javascript" src="js/controllers/controllers.js"></script> <script type="text/javascript" src="js/services/services.js"></script> <script type="text/javascript" src="js/directives/directives.js"></script> </head> <body> <div> <div dropdowns></div> <div uploaddir></div> </div> </body> </html>
use <div upload-dir></div>
. directive names in camel case normalised dashes when matching against html elements.
Comments
Post a Comment