I had some scripts specific to a view. However, the script does not seem to execute 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 - loads under ng-view
hello world
<script>
alert('Hello, John!')
</script>
In this example, when the page load, I see a basic hello world printed on the website. However, I do not get any pop up saying "Hello, John".
Any idea why I cannot load scripts specific to a certain view?
Extra info 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'
];
});