MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / bootstrap

Function bootstrap

code/songhop/www/lib/angular/angular.js:1407–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 Protractor based end-to-end tests cannot use this function to bootstrap manually. * They must use {@

(element, modules, config)

Source from the content-addressed store, hash-verified

1405 * @returns {auto.$injector} Returns the newly created injector for this app.
1406 */
1407function bootstrap(element, modules, config) {
1408 if (!isObject(config)) config = {};
1409 var defaultConfig = {
1410 strictDi: false
1411 };
1412 config = extend(defaultConfig, config);
1413 var doBootstrap = function() {
1414 element = jqLite(element);
1415
1416 if (element.injector()) {
1417 var tag = (element[0] === document) ? 'document' : startingTag(element);
1418 //Encode angle brackets to prevent input from being sanitized to empty string #8683
1419 throw ngMinErr(
1420 'btstrpd',
1421 "App Already Bootstrapped with this Element '{0}'",
1422 tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
1423 }
1424
1425 modules = modules || [];
1426 modules.unshift(['$provide', function($provide) {
1427 $provide.value('$rootElement', element);
1428 }]);
1429
1430 if (config.debugInfoEnabled) {
1431 // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.
1432 modules.push(['$compileProvider', function($compileProvider) {
1433 $compileProvider.debugInfoEnabled(true);
1434 }]);
1435 }
1436
1437 modules.unshift('ng');
1438 var injector = createInjector(modules, config.strictDi);
1439 injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
1440 function bootstrapApply(scope, element, compile, injector) {
1441 scope.$apply(function() {
1442 element.data('$injector', injector);
1443 compile(element)(scope);
1444 });
1445 }]
1446 );
1447 return injector;
1448 };
1449
1450 var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;
1451 var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
1452
1453 if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {
1454 config.debugInfoEnabled = true;
1455 window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');
1456 }
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) {

Callers 1

angularInitFunction · 0.70

Calls 4

isObjectFunction · 0.70
extendFunction · 0.70
doBootstrapFunction · 0.70
forEachFunction · 0.70

Tested by

no test coverage detected