MCPcopy Create free account
hub / github.com/bclinkinbeard/angular / bootstrap

Function bootstrap

test/fixtures/foo.js:1426–1469  ·  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

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

Callers 1

angularInitFunction · 0.85

Calls 2

doBootstrapFunction · 0.85
forEachFunction · 0.85

Tested by

no test coverage detected