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

Function bootstrap

lib/test/angular/1.8.0/angular.js:1932–1998  ·  view source on GitHub ↗

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

(element, modules, config)

Source from the content-addressed store, hash-verified

1930 * @returns {auto.$injector} Returns the newly created injector for this app.
1931 */
1932function bootstrap(element, modules, config) {
1933 if (!isObject(config)) config = {};
1934 var defaultConfig = {
1935 strictDi: false
1936 };
1937 config = extend(defaultConfig, config);
1938 var doBootstrap = function() {
1939 element = jqLite(element);
1940
1941 if (element.injector()) {
1942 var tag = (element[0] === window.document) ? 'document' : startingTag(element);
1943 // Encode angle brackets to prevent input from being sanitized to empty string #8683.
1944 throw ngMinErr(
1945 'btstrpd',
1946 'App already bootstrapped with this element \'{0}\'',
1947 tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
1948 }
1949
1950 modules = modules || [];
1951 modules.unshift(['$provide', function($provide) {
1952 $provide.value('$rootElement', element);
1953 }]);
1954
1955 if (config.debugInfoEnabled) {
1956 // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.
1957 modules.push(['$compileProvider', function($compileProvider) {
1958 $compileProvider.debugInfoEnabled(true);
1959 }]);
1960 }
1961
1962 modules.unshift('ng');
1963 var injector = createInjector(modules, config.strictDi);
1964 injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
1965 function bootstrapApply(scope, element, compile, injector) {
1966 scope.$apply(function() {
1967 element.data('$injector', injector);
1968 compile(element)(scope);
1969 });
1970 }]
1971 );
1972 return injector;
1973 };
1974
1975 var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;
1976 var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
1977
1978 if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {
1979 config.debugInfoEnabled = true;
1980 window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');
1981 }
1982
1983 if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
1984 return doBootstrap();
1985 }
1986
1987 window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
1988 angular.resumeBootstrap = function(extraModules) {
1989 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