MCPcopy
hub / github.com/angular-ui/ui-router / angularInit

Function angularInit

test/angular/1.6/angular.js:1841–1873  ·  view source on GitHub ↗

* @ngdoc directive * @name ngApp * @module ng * * @element ANY * @param {angular.Module} ngApp an optional application * angular.module module name to load. * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be * created in "strict-d

(element, bootstrap)

Source from the content-addressed store, hash-verified

1839 </example>
1840 */
1841function angularInit(element, bootstrap) {
1842 var appElement,
1843 module,
1844 config = {};
1845
1846 // The element `element` has priority over any other element.
1847 forEach(ngAttrPrefixes, function(prefix) {
1848 var name = prefix + 'app';
1849
1850 if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
1851 appElement = element;
1852 module = element.getAttribute(name);
1853 }
1854 });
1855 forEach(ngAttrPrefixes, function(prefix) {
1856 var name = prefix + 'app';
1857 var candidate;
1858
1859 if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) {
1860 appElement = candidate;
1861 module = candidate.getAttribute(name);
1862 }
1863 });
1864 if (appElement) {
1865 if (!isAutoBootstrapAllowed) {
1866 window.console.error('AngularJS: disabling automatic bootstrap. <script> protocol indicates ' +
1867 'an extension, document.location.href does not match.');
1868 return;
1869 }
1870 config.strictDi = getNgAttribute(appElement, 'strict-di') !== null;
1871 bootstrap(appElement, module ? [module] : [], config);
1872 }
1873}
1874
1875/**
1876 * @ngdoc function

Callers 1

angular.jsFile · 0.70

Calls 3

forEachFunction · 0.70
getNgAttributeFunction · 0.70
bootstrapFunction · 0.70

Tested by

no test coverage detected