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