MCPcopy
hub / github.com/angular-ui/ui-router / bootstrap

Function bootstrap

test/angular/1.2/angular.js:1428–1471  ·  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

1426 * @returns {auto.$injector} Returns the newly created injector for this app.
1427 */
1428function bootstrap(element, modules) {
1429 var doBootstrap = function() {
1430 element = jqLite(element);
1431
1432 if (element.injector()) {
1433 var tag = (element[0] === document) ? 'document' : startingTag(element);
1434 //Encode angle brackets to prevent input from being sanitized to empty string #8683
1435 throw ngMinErr(
1436 'btstrpd',
1437 "App Already Bootstrapped with this Element '{0}'",
1438 tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
1439 }
1440
1441 modules = modules || [];
1442 modules.unshift(['$provide', function($provide) {
1443 $provide.value('$rootElement', element);
1444 }]);
1445 modules.unshift('ng');
1446 var injector = createInjector(modules);
1447 injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector', '$animate',
1448 function(scope, element, compile, injector, animate) {
1449 scope.$apply(function() {
1450 element.data('$injector', injector);
1451 compile(element)(scope);
1452 });
1453 }]
1454 );
1455 return injector;
1456 };
1457
1458 var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
1459
1460 if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
1461 return doBootstrap();
1462 }
1463
1464 window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
1465 angular.resumeBootstrap = function(extraModules) {
1466 forEach(extraModules, function(module) {
1467 modules.push(module);
1468 });
1469 doBootstrap();
1470 };
1471}
1472
1473var SNAKE_CASE_REGEXP = /[A-Z]/g;
1474function snake_case(name, separator) {

Callers 1

angularInitFunction · 0.70

Calls 2

doBootstrapFunction · 0.70
forEachFunction · 0.70

Tested by

no test coverage detected