我在使用ui-router的angularjs中收到此错误。我不知道是什么设置它,我无法追踪它。有没有人在此之前遇到过这个问题或对此有所了解?
我正在使用带有MEAN堆栈的yeoman(mongodb,express,angularjs,node.js)。我感觉错误在下面列出的states.js
中。当错误开始出现时,这是我唯一一直在努力的事情。
TypeError: Cannot call method 'insertBefore' of null
at http://localhost:9000/bower_components/angular/angular.js:3857:22
at forEach (http://localhost:9000/bower_components/angular/angular.js:303:18)
at Object.enter (http://localhost:9000/bower_components/angular/angular.js:3856:9)
at http://localhost:9000/bower_components/angular/angular.js:18828:26
at publicLinkFn (http://localhost:9000/bower_components/angular/angular.js:5443:29)
at boundTranscludeFn (http://localhost:9000/bower_components/angular/angular.js:5555:21)
at controllersBoundTransclude (http://localhost:9000/bower_components/angular/angular.js:6145:18)
at ngRepeatAction (http://localhost:9000/bower_components/angular/angular.js:18826:15)
at Object.$watchCollectionAction (http://localhost:9000/bower_components/angular/angular.js:11347:11)
at Object.applyFunction [as fn] (<anonymous>:778:50) angular.js:9101
这是我的states.js
angular.module('lifeloggerApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ui',
'ui.router'
])
.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise("/Welcome");
$stateProvider
.state('Welcome', {
url: "/Welcome",
templateUrl: "views/welcome.html"
})
.state('Welcome.About', {
url: "/about",
templateUrl: "views/about.html"
})
.state('Welcome.Contact', {
url: "/contact",
templateUrl: "views/contact.html"
})
.state('Welcome.Login', {
url: "/login",
templateUrl: "views/login.html"
})
.state('a', {
url: "/a",
views: {
'': {
templateUrl: "views/main.html",
controller: 'MainCtrl'
},
'sidebar@a': {
templateUrl: "views/sidebar.html"
}
}
})
.state('a.Dashboard', {
url: "/dashboard",
templateUrl: "views/dashboard.html"
})
.state('a.About', {
url: "/about",
templateUrl: "views/about.html"
})
.state('a.Contact', {
url: "/contact",
templateUrl: "views/contact.html"
})
.state('a.Profile', {
abstract: true,
url: "/profile",
templateUrl: "views/profile.html"
})
.state('a.Profile.UserInfo', {
url: "/userinfo",
templateUrl: "views/profile.userinfo.html"
})
.state('a.Profile.EmailPref', {
url: "/emailpref",
templateUrl: "views/profile.emailpref.html"
})
.state('a.Profile.API', {
url: "/api",
templateUrl: "views/profile.api.html"
})
.state('a.Profile.Billing', {
url: "/billing",
templateUrl: "views/profile.billing.html"
})
.state('a.Profile.Settings', {
url: "/settings",
templateUrl: "views/profile.settings.html"
})
$urlRouterProvider.when('/a/profile', '/a/profile/userinfo');
});