I've got a small ng-app
/ng-controller
block inside a large HTML file. I thought ng-app
would be triggered after its div
is loaded but in my case it waits for document.ready
event.
When does angular instantiate ng-app
?
Only one ngApp directive can be auto-bootloaded per HTML Document but you can have multiple apps as long as you manually bootstrap the subsequent ones.
You can't use one ng-app inside another one in angularjs. because AngularJS applications cannot be nested within each other.
No, it waits for DOM content to load. See the diagram from this documentation https://docs.angularjs.org/guide/bootstrap.
You can wait for dom ready with ready()
.
angular.module("Foo")
.controller("Bar", function () {
angular.element(document).ready(function () {
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With