即時通過Angular和Firebase應用程序弄溼我的腳。我遇到了以下控制檯錯誤。如果你能幫我弄清楚有什麼問題,我無法弄清楚。在AngularJS應用程序中未被捕獲的語法錯誤
而且,我在index.html的inculded這個腳本
app.js:44 Uncaught SyntaxError: Unexpected token .
angular.js:68 Uncaught Error: [$injector:nomod] Module 'ngClassifieds' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.5.0/$injector/nomod?p0=ngClassifieds(anonymous function) @ angular.js:68(anonymous function) @ angular.js:2015ensure @ angular.js:1939module @ angular.js:2013(anonymous function) @ classifieds.ctr.js:6(anonymous function) @ classifieds.ctr.js:86
angular.js:68 Uncaught Error: [$injector:nomod] Module 'ngClassifieds' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.5.0/$injector/nomod?p0=ngClassifieds(anonymous function) @ angular.js:68(anonymous function) @ angular.js:2015ensure @ angular.js:1939module @ angular.js:2013(anonymous function) @ classifieds.fac.js:6(anonymous function) @ classifieds.fac.js:28
angular.js:68 Uncaught Error: [$injector:nomod] Module 'ngClassifieds' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.5.0/$injector/nomod?p0=ngClassifieds(anonymous function) @ angular.js:68(anonymous function) @ angular.js:2015ensure @ angular.js:1939module @ angular.js:2013(anonymous function) @ auth.ctr.js:6(anonymous function) @ auth.ctr.js:44
angular.js:68 Uncaught Error: [$injector:nomod] Module 'ngClassifieds' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.5.0/$injector/nomod?p0=ngClassifieds(anonymous function) @ angular.js:68(anonymous function) @ angular.js:2015ensure @ angular.js:1939module @ angular.js:2013(anonymous function) @ auth.fac.js:6(anonymous function) @ auth.fac.js:18
angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module ngClassifieds due to:
Error: [$injector:nomod] Module 'ngClassifieds' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.5.0/$injector/nomod?p0=ngClassifieds
at http://localhost:8080/node_modules/angular/angular.js:68:12
at http://localhost:8080/node_modules/angular/angular.js:2015:17
at ensure (http://localhost:8080/node_modules/angular/angular.js:1939:38)
at module (http://localhost:8080/node_modules/angular/angular.js:2013:14)
at http://localhost:8080/node_modules/angular/angular.js:4503:22
at forEach (http://localhost:8080/node_modules/angular/angular.js:321:20)
at loadModules (http://localhost:8080/node_modules/angular/angular.js:4487:5)
at createInjector (http://localhost:8080/node_modules/angular/angular.js:4409:19)
at doBootstrap (http://localhost:8080/node_modules/angular/angular.js:1691:20)
at bootstrap (http://localhost:8080/node_modules/angular/angular.js:1712:12)
http://errors.angularjs.org/1.5.0/$injector/modulerr?p0=ngClassifieds&p1=Er…3A%2F%2Flocalhost%3A8080%2Fnode_modules%2Fangular%2Fangular.js%3A1712%3A12)(anonymous function) @ angular.js:68(anonymous function) @ angular.js:4526forEach @ angular.js:321loadModules @ angular.js:4487createInjector @ angular.js:4409doBootstrap @ angular.js:1691bootstrap @ angular.js:1712angularInit @ angular.js:1606(anonymous function) @ angular.js:30423trigger @ angular.js:3108defaultHandlerWrapper @ angular.js:3398eventHandler @ angular.js:3386
在上述錯誤引用的代碼如下:
angular.module('ngClassifieds', ['ngMaterial', 'ui.router', 'firebase'])
.run(["$rootScope", "$state", function($rootScope, $state) {
$rootScope.$on("$stateChangeError", function(event, toState, toParams, fromState, fromParams, error) {
// We can catch the error thrown when the $requireAuth promise is rejected
// and redirect the user back to the home page
if (error === "AUTH_REQUIRED") {
$state.go("auth");
}
});
}]);
.config(function($mdThemingProvider, $stateProvider, $urlRouterProvider) {
$mdThemingProvider
.theme('default')
.primaryPalette('blue-grey')
.accentPalette('orange');
$urlRouterProvider.otherwise('/auth');
$stateProvider
.state('auth', {
url: '/auth',
templateUrl: 'components/auth/auth.tpl.html',
controller: 'authCtrl',
})
$stateProvider
.state('masters', {
url: '/masters',
templateUrl: 'components/classifieds.tpl.html',
controller: 'classifiedsCtrl',
resolve: {
// controller will not be loaded until $requireAuth resolves
// Auth refers to our $firebaseAuth wrapper in the example above
"currentAuth": ["auth", function(auth) {
// $requireAuth returns a promise so the resolve waits for it to complete
// If the promise is rejected, it will throw a $stateChangeError (see above)
return auth.ref.$requireAuth();
}]
}
});
});
此文件ngClassifieds是否在index.html中添加? – Rakeschand
你是否在你的html,body或者其他元素中聲明過它:''? – thepio
是的。上面的codereference是文件 - app.js,我已經將它作爲腳本包含在index.html – Nosail