* @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)
| 1797 | </example> |
| 1798 | */ |
| 1799 | function angularInit(element, bootstrap) { |
| 1800 | var appElement, |
| 1801 | module, |
| 1802 | config = {}; |
| 1803 | |
| 1804 | // The element `element` has priority over any other element. |
| 1805 | forEach(ngAttrPrefixes, function(prefix) { |
| 1806 | var name = prefix + 'app'; |
| 1807 | |
| 1808 | if (!appElement && element.hasAttribute && element.hasAttribute(name)) { |
| 1809 | appElement = element; |
| 1810 | module = element.getAttribute(name); |
| 1811 | } |
| 1812 | }); |
| 1813 | forEach(ngAttrPrefixes, function(prefix) { |
| 1814 | var name = prefix + 'app'; |
| 1815 | var candidate; |
| 1816 | |
| 1817 | if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) { |
| 1818 | appElement = candidate; |
| 1819 | module = candidate.getAttribute(name); |
| 1820 | } |
| 1821 | }); |
| 1822 | if (appElement) { |
| 1823 | if (!isAutoBootstrapAllowed) { |
| 1824 | window.console.error('AngularJS: disabling automatic bootstrap. <script> protocol indicates ' + |
| 1825 | 'an extension, document.location.href does not match.'); |
| 1826 | return; |
| 1827 | } |
| 1828 | config.strictDi = getNgAttribute(appElement, 'strict-di') !== null; |
| 1829 | bootstrap(appElement, module ? [module] : [], config); |
| 1830 | } |
| 1831 | } |
| 1832 | |
| 1833 | /** |
| 1834 | * @ngdoc function |
no test coverage detected