AngularJS - how to execute code in module.run section -
i tried google this, couldn't find helpful.
index.html looks this:
<!doctype html> <html data-ng-app="app"> <head> ... <script src="/script/jquery.js"></script> <script src="/script/angular.js"></script> <script src="/script/app_module.js"></script> ... </head> <body> ... </body> </html> and app_module.js this:
var app = angular.module('app', []); app.run(function() { console.log("app run"); }); and don't console output. btw tried same thing in jsfiddle , worked perfectly.
i'm confused. ideas why doesn't run?
angularjs 1.4
adding / @ beginning of src ensures path not relative read root of site.
remove starting slashes, root somewhere else, in parent folder:
<script src="script/jquery.js"></script> <script src="script/angular.js"></script> <script src="script/app_module.js"></script>
Comments
Post a Comment