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

Function bootstrap

lib/test/angular/1.6.7/angular.js:1924–1990  ·  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

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