0
我有一個angularjs應用程序,可以在Chrome和Firefox甚至Edge中完美運行!雖然不在IE11上。Angularjs由於以下原因無法實例化模塊WebApp:錯誤:在匿名函數
我已經嘗試包裹我init.js如下:
變種web應用= angular.module( 'Web應用程序',[ 'ngRoute', 'ui.bootstrap', '角山魈',「火力「]);
(function() {
angular.module('WebApp').run(function($rootScope,$timeout) {
$timeout(function(){
$rootScope.$on('$routeChangeSuccess', function(ev, data) {
if (data && data.controller) {
var controller = data.controller;
controller = controller.charAt(0).toLowerCase() + controller.slice(1);
controller = controller.replace(/Controller/g, '');
$rootScope.controller = controller;
}
});
}, 100);
}).$inject = ['$rootScope'];
}).bind(window);
我也試着包我所有的控制器,如:
(函數(角){ 「使用嚴格的」;
//控制器在這裏 }(window.angular) );
其他人有一些想法? 謝謝!
EDITED! - 其他錯誤堆棧:) -
HTML1300: Navigation occurred.
localhost:8000
SCRIPT1006: Expected ')'
angular-mandrill.js (1,597)
SCRIPT5022: [$injector:modulerr] http://errors.angularjs.org/1.5.5/$injector/modulerr?p0=WebApp&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.5.5%2F%24injector%2Fmodulerr%3Fp0%3Dangular-mandrill%26p1%3DError%253A%2520%255B%2524injector%253Anomod%255D%2520http%253A%252F%252Ferrors.angularjs.org%252F1.5.5%252F%2524injector%252Fnomod%253Fp0%253Dangular-mandrill%250A%2520%2520%2520at%2520Anonymous%2520function%2520(http%253A%252F%252Flocalhost%253A8000%252Fassets%252Fexternal%252Fangular%252Fangular.min.js%253A25%253A229)%250A%2520%2520%2520at%2520b%2520(http%253A%252F%252Flocalhost%253A8000%252Fassets%252Fexternal%252Fangular%252Fangular.min.js%253A24%253A263)%250A%2520%2520%2520at%2520Anonymous%2520function%2520(http%253A%252F%252Flocalhost%253A8000%252Fassets%252Fexternal%252Fangular%252Fangular.min.js%253A25%253A13)%250A%2520%2520%2520at%2520Anonymous%2520function%2520(http%253A%252F%252Flocalhost%253A8000%252Fassets%252Fexternal%252Fangular%252Fangular.min.js%253A39%253A372)%250A%2520%2520%2520at%2520q%2520(http%253A%252F%252Flocalhost%253A8000%252Fassets%252Fexternal%252Fangular%252Fangular.min.js%253A7%253A353)%250A%2520%2520%2520at%2520g%2520(http%253A%252F%252Flocalhost%253A8000%252Fassets%252Fexternal%252Fangular%252Fangular.min.js%253A39%253A222)%250A%2520%2520%2520at%2520Anonymous%2520function%2520(http%253A%252F%252Flocalhost%253A8000%252Fassets%252Fexternal%252Fangular%252Fangular.min.js%253A39%253A380)%250A%2520%2520%2520at%2520q%2520(http%253A%252F%252Flocalhost%253A8000%252Fassets%252Fexternal%252Fangular%252Fangular.min.js%253A7%253A353)%250A%2520%2520%2520at%2520g%2520(http%253A%252F%252Flocalhost%253A8000%252Fassets%252Fexternal%252Fangular%252Fangular.min.js%253A39%253A222)%250A%2520%2520%2520at%2520bb%2520(http%253A%252F%252Flocalhost%253A8000%252Fassets%252Fexternal%252Fangular%252Fangular.min.js%253A43%253A240)%0A%20%20%20at%20Anonymous%20function%20(http%3A%2F%2Flocalhost%3A8000%2Fassets%2Fexternal%2Fangular%2Fangular.min.js%3A40%3A25)%0A%20%20%20at%20q%20(http%3A%2F%2Flocalhost%3A8000%2Fassets%2Fexternal%2Fangular%2Fangular.min.js%3A7%3A353)%0A%20%20%20at%20g%20(http%3A%2F%2Flocalhost%3A8000%2Fassets%2Fexternal%2Fangular%2Fangular.min.js%3A39%3A222)%0A%20%20%20at%20Anonymous%20function%20(http%3A%2F%2Flocalhost%3A8000%2Fassets%2Fexternal%2Fangular%2Fangular.min.js%3A39%3A380)%0A%20%20%20at%20q%20(http%3A%2F%2Flocalhost%3A8000%2Fassets%2Fexternal%2Fangular%2Fangular.min.js%3A7%3A353)%0A%20%20%20at%20g%20(http%3A%2F%2Flocalhost%3A8000%2Fassets%2Fexternal%2Fangular%2Fangular.min.js%3A39%3A222)%0A%20%20%20at%20bb%20(http%3A%2F%2Flocalhost%3A8000%2Fassets%2Fexternal%2Fangular%2Fangular.min.js%3A43%3A240)%0A%20%20%20at%20c%20(http%3A%2F%2Flocalhost%3A8000%2Fassets%2Fexternal%2Fangular%2Fangular.min.js%3A21%3A17)%0A%20%20%20at%20yc%20(http%3A%2F%2Flocalhost%3A8000%2Fassets%2Fexternal%2Fangular%2Fangular.min.js%3A21%3A325)%0A%20%20%20at%20ee%20(http%3A%2F%2Flocalhost%3A8000%2Fassets%2Fexternal%2Fangular%2Fangular.min.js%3A20%3A156)
angular.min.js (40,25)
rendered http://localhost:8000/assets/css/style.less successfully.
css for http://localhost:8000/assets/css/style.less generated in 1641ms
less has finished. css generated in 1641ms
嘿stej4n,感謝您的輸入!不幸的是似乎沒有工作。仍然得到SCRIPT5022:[$注射器:modulerr] http://errors.angularjs.org/1.5.5/$injector/modulerr?p0=WebApp – kierandes
你仍然有這個代碼相同的錯誤?因爲你沒有注入''$ timeout''。你能提供完整的錯誤堆棧嗎? –
似乎是相同的錯誤。其實它似乎指向角 - mandrill,雖然我不知道這是角度本身沒有加載的結果。我在這裏字符有限,所以我會發布儘可能多的:) - 無法實例化模塊WebApp,因爲: 錯誤:[$ injector:modulerr] http://errors.angularjs.org/1.5.5/ $ http injector/modulerr?p0 = a ...) at匿名函數(http:// localhost:8000/assets/external/angular/angular.min.js:40:25) at q(http:// localhost :8000/asse – kierandes