MCPcopy Create free account
hub / github.com/binux/qiandao / bootstrap

Function bootstrap

web/static/components/angularjs/angular.js:1421–1460  ·  view source on GitHub ↗

* @ngdoc function * @name angular.bootstrap * @module ng * @description * Use this function to manually start up angular application. * * See: guide/bootstrap Bootstrap * * Note that ngScenario-based end-to-end tests cannot use this function to bootstrap manually. * They must use {@

(element, modules)

Source from the content-addressed store, hash-verified

1419 * @returns {auto.$injector} Returns the newly created injector for this app.
1420 */
1421function bootstrap(element, modules) {
1422 var doBootstrap = function() {
1423 element = jqLite(element);
1424
1425 if (element.injector()) {
1426 var tag = (element[0] === document) ? 'document' : startingTag(element);
1427 throw ngMinErr('btstrpd', "App Already Bootstrapped with this Element '{0}'", tag);
1428 }
1429
1430 modules = modules || [];
1431 modules.unshift(['$provide', function($provide) {
1432 $provide.value('$rootElement', element);
1433 }]);
1434 modules.unshift('ng');
1435 var injector = createInjector(modules);
1436 injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector', '$animate',
1437 function(scope, element, compile, injector, animate) {
1438 scope.$apply(function() {
1439 element.data('$injector', injector);
1440 compile(element)(scope);
1441 });
1442 }]
1443 );
1444 return injector;
1445 };
1446
1447 var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
1448
1449 if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
1450 return doBootstrap();
1451 }
1452
1453 window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
1454 angular.resumeBootstrap = function(extraModules) {
1455 forEach(extraModules, function(module) {
1456 modules.push(module);
1457 });
1458 doBootstrap();
1459 };
1460}
1461
1462var SNAKE_CASE_REGEXP = /[A-Z]/g;
1463function snake_case(name, separator) {

Callers 1

angularInitFunction · 0.85

Calls 2

doBootstrapFunction · 0.85
forEachFunction · 0.85

Tested by

no test coverage detected