Angular this.path 不是一个函数



我收到错误"this.path 不是函数">

我在代码中没有"this.path",我认为它指的是我的状态,但我没有碰到任何运气来弄清楚问题到底是什么。错误是:

stateService.ts:530 TypeError: this.path is not a function
at LocationHtml5Url.url (angular.js:13744)
at Object.coreservices_1.services.location.setUrl (services.ts:209)
at UrlRouter.push (urlRouter.ts:376)
at updateUrl (url.ts:24)
at TransitionHook.invokeHook (transitionHook.ts:44)
at TransitionHook.runSynchronousHooks (transitionHook.ts:108)
at transitionSuccess (transition.ts:507)
at processQueue (angular.js:16832)
at angular.js:16876
at Scope.$digest (angular.js:17971)

这是从我假设的一些埋藏角状态路由触发的(因为我不使用打字稿(。在更改路由时、解析之后但在加载控制器之前,会发生这种情况。

此外,即使出现此错误,下一页似乎也会加载(控制台.log在控制器中触发(。

如果有帮助,我认为这是代码在错误之前在我的部分中到达的最后一个区域(这绑定在父路由系统的非常大的状态解析中(

currentProfile: function($rootScope, UserProfileService) {
return UserProfileService.fetchClientProfile().then(function(profile) {
console.log(profile)
$rootScope.user = {
name: profile.fullName || profile.firstName
};
return profile;
});
}

问题最终出在我的拦截器上。虽然看起来它工作正常,但这是由于 cookie LATE 的分辨率,这是因为它有时在加载下一个控制器之前随机解析,有时在加载下一个控制器之后随机解析(我一直没有这个错误(。

我通常无法访问此页面,除非您有cookie。所以它进入页面,然后 cookie 会解决,导致奇怪的问题。它可能应该拒绝不同的错误。

最新更新