Manually bootstrapping AngularJS and then getting the module

后端 未结 4 922
闹比i
闹比i 2021-02-14 00:18

Generally, I\'d do the following and there would be an ng-app in my HTML:

var myApp = angular.module(\"myApp\", []);

myApp.controller(\"AttributeCt         


        
4条回答
  •  有刺的猬
    2021-02-14 00:53

    You cannot create a controller after you've bootstrapped the app. See the documentation for angular.bootstrap.

    You should call angular.bootstrap() after you've loaded or defined your modules. You cannot add controllers, services, directives, etc after an application bootstraps.

提交回复
热议问题