我正在设置一个带有角路由段的简单路由配置,并在app负载上抛出此错误:
TypeError: Cannot read property 'untilResolved' of undefined
在错误信息方面,角段和角段都没有提供更多的帮助。
app.js:
(function () {
'use strict';
var app = angular.module('emailHandlerApp', [
// Angular modules
'ngAnimate', // animations
'ngRoute', // routing
'ngSanitize', // sanitizes html bindings (ex: topnav.js)
// 3rd Party Modules
'ui.bootstrap', // ui-bootstrap (ex: carousel, pagination, dialog)
'route-segment', // angular-route-segment
'view-segment', // angular-route-segment
]);
console.log("app loaded"); // just for debug!
})();config.route.js:
(function () {
'use strict';
var app = angular.module('emailHandlerApp');
// Configure the routes and route resolvers
app.config(function ($routeSegmentProvider, $routeProvider) {
$routeSegmentProvider.options.autoLoadTemplates = true;
$routeSegmentProvider.options.strictMode = true;
$routeSegmentProvider
.when('/', 'emailHandler')
.when('/unsubscribe', 'emailHandler.unsubscribe')
.when('/redirect', 'emailHandler.redirect')
// Base shell
.segment('emailHandle', {
templateUrl: 'app/shell.html',
controller: 'baseController',
controllerAs: 'vm',
})
.within()
// Dashboard
.segment('unsubscribe', {
templateUrl: 'app/unsubscribe/unsubscribe.html',
controller: 'unsubscribeController',
controllerAs: 'vm',
dependencies: ['emailId']
})
// Recruiting
.segment('redirect', {
templateUrl: 'app/redirect/redirect.html',
controller: 'redirectController',
controllerAs: 'vm',
dependencies: ['rdId']
})
;
$routeProvider.otherwise({ redirectTo: '/' });
})
})();发布于 2014-12-12 16:16:12
回答我自己的问题,因为我有99%的肯定,我可能会再次谷歌这个一个月后。
这是一个超级简单的问题-只是一个代码盲目性的问题和一个稍微缺乏信息的错误信息。当您的段树中有一个不合适的名称时,角路径段会抛出这个。
在我的例子中,当我的意思是.segment('emailHandle', { ... })时,我错误地输入了emailHandler,然后当它击中.within()时,它就会勃起。我一看到它就觉得很傻。
https://stackoverflow.com/questions/27447699
复制相似问题