I had some presentation specific scenarios. However, the script does not seem to be executed when angularjs loads the view.
Index.html
<html> <body ng-app="adminApp"> <div ng-view=""></div> <script src="bower_components/angular/angular.js"></script> <script src="scripts/app.js"></script> <script src="scripts/controllers/main.js"></script> </body> </html>
Main.html - loaded under ng-view
hello world <script> alert('Hello, John!') </script>
In this example, when the page loads, I see the main world hello printed on the website. However, I do not receive the "Hello John" pop-up message.
Any idea why I can't load scripts specific to a particular view?
Additional information app.js
'use strict'; angular.module('adminApp', []) .config(function ($routeProvider) { $routeProvider .when('/', { templateUrl: 'views/main.html', controller: 'MainCtrl' }) .otherwise({ redirectTo: '/' }); });
Controllers /main.js
'use strict'; angular.module('adminApp') .controller('MainCtrl', function ($scope) { $scope.awesomeThings = [ 'HTML5 Boilerplate', 'AngularJS', 'Karma' ]; });
javascript html angularjs
Karan Aug 13 '13 at 22:20 2013-08-13 22:20
source share