MCPcopy Index your code
hub / github.com/angular-ui/ui-router / bootstrap

Function bootstrap

test/angular/1.5/angular.js:1778–1844  ·  view source on GitHub ↗

* @ngdoc function * @name angular.bootstrap * @module ng * @description * Use this function to manually start up angular application. * * For more information, see the guide/bootstrap Bootstrap guide. * * Angular will detect if it has been loaded into the browser more than once and o

(element, modules, config)

Source from the content-addressed store, hash-verified

1776 * @returns {auto.$injector} Returns the newly created injector for this app.
1777 */
1778function bootstrap(element, modules, config) {
1779 if (!isObject(config)) config = {};
1780 var defaultConfig = {
1781 strictDi: false
1782 };
1783 config = extend(defaultConfig, config);
1784 var doBootstrap = function() {
1785 element = jqLite(element);
1786
1787 if (element.injector()) {
1788 var tag = (element[0] === window.document) ? 'document' : startingTag(element);
1789 // Encode angle brackets to prevent input from being sanitized to empty string #8683.
1790 throw ngMinErr(
1791 'btstrpd',
1792 'App already bootstrapped with this element \'{0}\'',
1793 tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
1794 }
1795
1796 modules = modules || [];
1797 modules.unshift(['$provide', function($provide) {
1798 $provide.value('$rootElement', element);
1799 }]);
1800
1801 if (config.debugInfoEnabled) {
1802 // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.
1803 modules.push(['$compileProvider', function($compileProvider) {
1804 $compileProvider.debugInfoEnabled(true);
1805 }]);
1806 }
1807
1808 modules.unshift('ng');
1809 var injector = createInjector(modules, config.strictDi);
1810 injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
1811 function bootstrapApply(scope, element, compile, injector) {
1812 scope.$apply(function() {
1813 element.data('$injector', injector);
1814 compile(element)(scope);
1815 });
1816 }]
1817 );
1818 return injector;
1819 };
1820
1821 var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;
1822 var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
1823
1824 if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {
1825 config.debugInfoEnabled = true;
1826 window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');
1827 }
1828
1829 if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
1830 return doBootstrap();
1831 }
1832
1833 window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
1834 angular.resumeBootstrap = function(extraModules) {
1835 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