By default, the AngularJS function does not work unless I put it in <head>. Is there any way to put it at the end <body>instead?
My code is as follows:
$(document).ready(function() {
var myApp = angular.module("myApp", []);
myApp.bootstrap(document, ["myApp"]);
myApp.controller("AppController",["$scope", "$http", function() {
}]);
});
EDIT 3/31/14: Based on ederollora's answer and some research, I found that the call angular.bootstrap()should be called after everything is defined. The above code becomes the following:
$(document).ready(function() {
var myApp = angular.module("myApp", []);
myApp.controller("AppController",["$scope", "$http", function() {
}]);
myApp.bootstrap(document, ["myApp"]);
});
Also, in the interest of porting my application from jQuery to Angular, I am changing document.ready calls to the angular version:
angular.element(document).ready(function() {
var myApp = angular.module("myApp", []);
myApp.controller("AppController",["$scope", "$http", function() {
}]);
myApp.bootstrap(document, ["myApp"]);
});
The documentation was not clear what angular.boostrap()needed to be called after defining everything, so I went and improved the documentation.