@@ -819,29 +819,44 @@ function encodeUriQuery(val, pctEncodeSpaces) {
819
819
* `ng:autobind="[root element ID]"` tells Angular to compile and manage part of the document,
820
820
* starting at "root element ID".
821
821
*
822
-
823
822
*/
824
823
function angularInit ( config , document ) {
825
824
var autobind = config . autobind ;
826
825
827
826
if ( autobind ) {
828
- var modules = [ ngModule ] ;
827
+ var modules = [ ] ;
829
828
forEach ( ( config . modules || '' ) . split ( ',' ) , function ( module ) {
830
829
module = trim ( module ) ;
831
830
if ( module ) {
832
831
modules . push ( module ) ;
833
832
}
834
833
} ) ;
835
- createInjector ( modules , angularModule ) ( [ '$rootScope' , '$compile' , '$injector' , function ( scope , compile , injector ) {
836
- scope . $apply ( function ( ) {
837
- var element = jqLite ( isString ( autobind ) ? document . getElementById ( autobind ) : document ) ;
838
- element . data ( '$injector' , injector ) ;
839
- compile ( element ) ( scope ) ;
840
- } ) ;
841
- } ] ) ;
834
+ bootstrap ( jqLite ( isString ( autobind ) ? document . getElementById ( autobind ) : document ) , modules ) ;
842
835
}
843
836
}
844
837
838
+ /**
839
+ * @ngdoc function
840
+ * @name angular.bootstrap
841
+ * @description
842
+ * Use this function to manually start up angular application.
843
+ *
844
+ * See: {@link guide/dev_guide.bootstrap.manual_bootstrap Bootstrap}
845
+ *
846
+ * @param {Element } element DOM element which is the root of angular application.
847
+ * @param {Array<String,function>= } modules an array of module declarations. See: {@link angular.module modules}
848
+ */
849
+ function bootstrap ( element , modules ) {
850
+ modules = modules || [ ] ;
851
+ modules . unshift ( ngModule ) ;
852
+ createInjector ( modules , angularModule ) ( [ '$rootScope' , '$compile' , '$injector' , function ( scope , compile , injector ) {
853
+ scope . $apply ( function ( ) {
854
+ element . data ( '$injector' , injector ) ;
855
+ compile ( element ) ( scope ) ;
856
+ } ) ;
857
+ } ] ) ;
858
+ }
859
+
845
860
function angularJsConfig ( document ) {
846
861
bindJQuery ( ) ;
847
862
var scripts = document . getElementsByTagName ( 'script' ) ,
@@ -903,6 +918,7 @@ function assertArgFn(arg, name) {
903
918
904
919
function publishExternalAPI ( angular ) {
905
920
extend ( angular , {
921
+ 'bootstrap' : bootstrap ,
906
922
'copy' : copy ,
907
923
'extend' : extend ,
908
924
'equals' : equals ,
0 commit comments