Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/466.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 此路径不是一个函数_Javascript_Angularjs_Angular Ui Router - Fatal编程技术网

Javascript 此路径不是一个函数

Javascript 此路径不是一个函数,javascript,angularjs,angular-ui-router,Javascript,Angularjs,Angular Ui Router,我收到一个错误“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

我收到一个错误“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)
这是从我假设的某个掩埋角状态路由触发的(因为我不使用typescript)。在解析后但在加载控制器之前更改路由时会发生这种情况

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

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


问题最终出现在我的拦截器中。虽然它看起来工作得很好,但这是由于cookie的解析延迟所致,这是因为它在加载下一个控制器之前,有时在之后随机解析(我一直没有出现此错误)


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

这可能是一个错误。您使用的是什么版本的ui路由器?
currentProfile: function($rootScope, UserProfileService) {
                    return UserProfileService.fetchClientProfile().then(function(profile) {
                        console.log(profile)
                        $rootScope.user = {
                            name: profile.fullName || profile.firstName
                        };

                        return profile;
                    });
                }