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

Function bootstrap

lib/test/angular/1.5.0/angular.js:1660–1726  ·  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

1658 * @returns {auto.$injector} Returns the newly created injector for this app.
1659 */
1660function bootstrap(element, modules, config) {
1661 if (!isObject(config)) config = {};
1662 var defaultConfig = {
1663 strictDi: false
1664 };
1665 config = extend(defaultConfig, config);
1666 var doBootstrap = function() {
1667 element = jqLite(element);
1668
1669 if (element.injector()) {
1670 var tag = (element[0] === document) ? 'document' : startingTag(element);
1671 //Encode angle brackets to prevent input from being sanitized to empty string #8683
1672 throw ngMinErr(
1673 'btstrpd',
1674 "App Already Bootstrapped with this Element '{0}'",
1675 tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
1676 }
1677
1678 modules = modules || [];
1679 modules.unshift(['$provide', function($provide) {
1680 $provide.value('$rootElement', element);
1681 }]);
1682
1683 if (config.debugInfoEnabled) {
1684 // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.
1685 modules.push(['$compileProvider', function($compileProvider) {
1686 $compileProvider.debugInfoEnabled(true);
1687 }]);
1688 }
1689
1690 modules.unshift('ng');
1691 var injector = createInjector(modules, config.strictDi);
1692 injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
1693 function bootstrapApply(scope, element, compile, injector) {
1694 scope.$apply(function() {
1695 element.data('$injector', injector);
1696 compile(element)(scope);
1697 });
1698 }]
1699 );
1700 return injector;
1701 };
1702
1703 var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;
1704 var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
1705
1706 if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {
1707 config.debugInfoEnabled = true;
1708 window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');
1709 }
1710
1711 if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
1712 return doBootstrap();
1713 }
1714
1715 window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
1716 angular.resumeBootstrap = function(extraModules) {
1717 forEach(extraModules, function(module) {

Callers 1

angularInitFunction · 0.70

Calls 5

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

Tested by

no test coverage detected