angularJs中这些bootstrapping方法有什么区别?

时间:2022-06-18 13:33:22

Could not find the difference between these two.
Does this make sense to keep any of these to bootstrap my angular app?

找不到这两者之间的区别。将这些中的任何一个引导到我的角度应用程序是否有意义?

angular.bootstrap(document,['myApp']);

or

angularAMD.bootstrap(app);

1 个解决方案

#1


1  

angularAMD is an utility that facilitates the use of RequireJS in AngularJS applications supporting on-demand loading of 3rd party modules such as angular-ui.

angularAMD是一个实用程序,它有助于在AngularJS应用程序中使用RequireJS,支持按需加载第三方模块,如angular-ui。

And this module provides you

这个模块为您提供

define(['angularAMD'], function (angularAMD) {
    var app = angular.module(app_name, ['webapp']);
    ... // Setup app here. E.g.: run .config with $routeProvider
    return angularAMD.bootstrap(app);
});

Where as angular.bootstrap(document,['myApp']); link is in build angular method to boostrap application.

在哪里作为angular.bootstrap(document,['myApp']); link是建立角度方法到boostrap应用程序。

Use any of it but stick with one only.

使用其中任何一个但只坚持一个。

#1


1  

angularAMD is an utility that facilitates the use of RequireJS in AngularJS applications supporting on-demand loading of 3rd party modules such as angular-ui.

angularAMD是一个实用程序,它有助于在AngularJS应用程序中使用RequireJS,支持按需加载第三方模块,如angular-ui。

And this module provides you

这个模块为您提供

define(['angularAMD'], function (angularAMD) {
    var app = angular.module(app_name, ['webapp']);
    ... // Setup app here. E.g.: run .config with $routeProvider
    return angularAMD.bootstrap(app);
});

Where as angular.bootstrap(document,['myApp']); link is in build angular method to boostrap application.

在哪里作为angular.bootstrap(document,['myApp']); link是建立角度方法到boostrap应用程序。

Use any of it but stick with one only.

使用其中任何一个但只坚持一个。