* @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
(element, bootstrap)
| 1907 | </example> |
| 1908 | */ |
| 1909 | function angularInit(element, bootstrap) { |
| 1910 | var appElement, |
| 1911 | module, |
| 1912 | config = {}; |
| 1913 | |
| 1914 | // The element `element` has priority over any other element. |
| 1915 | forEach(ngAttrPrefixes, function (prefix) { |
| 1916 | var name = prefix + 'app'; |
| 1917 | |
| 1918 | if (!appElement && element.hasAttribute && element.hasAttribute(name)) { |
| 1919 | appElement = element; |
| 1920 | module = element.getAttribute(name); |
| 1921 | } |
| 1922 | }); |
| 1923 | forEach(ngAttrPrefixes, function (prefix) { |
| 1924 | var name = prefix + 'app'; |
| 1925 | var candidate; |
| 1926 | |
| 1927 | if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) { |
| 1928 | appElement = candidate; |
| 1929 | module = candidate.getAttribute(name); |
| 1930 | } |
| 1931 | }); |
| 1932 | if (appElement) { |
| 1933 | if (!isAutoBootstrapAllowed) { |
| 1934 | window.console.error('AngularJS: disabling automatic bootstrap. <script> protocol indicates ' + |
| 1935 | 'an extension, document.location.href does not match.'); |
| 1936 | return; |
| 1937 | } |
| 1938 | config.strictDi = getNgAttribute(appElement, 'strict-di') !== null; |
| 1939 | bootstrap(appElement, module ? [module] : [], config); |
| 1940 | } |
| 1941 | } |
| 1942 | |
| 1943 | /** |
| 1944 | * @ngdoc function |
no test coverage detected