Error: Current componentRef is different for cached componentRef
Error: Current componentRef is different for cached componentRef
我正在开发 NativeScript Angular 2 应用程序。
我有一个包含一堆对象的 ListView。点击其中一个对象会打开一个新组件。按后退按钮返回列表并按列表中的另一个对象后,出现以下错误:
我该如何解决这个问题?
CONSOLE ERROR file:///app/tns_modules/@angular/core/./bundles/core.umd.js:1091:24: ERROR Error: Uncaught (in promise): Error: Current componentRef is different for cached componentRef
deactivate@file:///app/tns_modules/nativescript-angular/router/page-router-outlet.js:105:32 [angular]
deactiveRouteAndOutlet@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4578:30 [angular]
deactiveRouteAndItsChildren@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4538:40 [angular]
deactivateRoutes@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4467:49 [angular]
file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4429:35 [angular]
forEach@[native code] [angular]
deactivateChildRoutes@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4428:36 [angular]
activate@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4415:35 [angular]
file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4034:30 [angular]
file:///app/tns_modules/rxjs/Observable.js:110:25 [angular]
__tryOrSetError@file:///app/tns_modules/rxjs/Subscriber.js:247:20 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:187:42 [angular]
_next@file:///app/tns_modules/rxjs/Subscriber.js:125:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ScalarObservable.js:49:28 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_complete@file:///app/tns_modules/rxjs/operator/reduce.js:119:34 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_complete@file:///app/tns_modules/rxjs/operator/mergeMap.js:135:38 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ArrayObservable.js:116:32 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyComplete@file:///app/tns_modules/rxjs/operator/every.js:53:30 [angular]
_complete@file:///app/tns_modules/rxjs/operator/every.js:70:28 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_complete@file:///app/tns_modules/rxjs/operator/mergeMap.js:135:38 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ArrayObservable.js:116:32 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyComplete@file:///app/tns_modules/rxjs/operator/every.js:53:30 [angular]
_complete@file:///app/tns_modules/rxjs/operator/every.js:70:28 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_complete@file:///app/tns_modules/rxjs/operator/mergeMap.js:135:38 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ArrayObservable.js:116:32 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ScalarObservable.js:49:28 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ScalarObservable.js:49:28 [angular]
```
我遇到这个错误是因为详细信息页面在操作栏中引用了一个对象 属性...(看起来它在操作栏呈现时没有实例化)希望它有帮助
我刚刚在我的属性中添加了一个 *ngIf 来验证它不是未定义的。
示例:
<StackLayout *ngIf="example">
<Label textWrap="true" [text]="example.title"></Label>
<Image [src]="example.image" height="100"></Image>
</StackLayout>
我正在开发 NativeScript Angular 2 应用程序。
我有一个包含一堆对象的 ListView。点击其中一个对象会打开一个新组件。按后退按钮返回列表并按列表中的另一个对象后,出现以下错误:
我该如何解决这个问题?
CONSOLE ERROR file:///app/tns_modules/@angular/core/./bundles/core.umd.js:1091:24: ERROR Error: Uncaught (in promise): Error: Current componentRef is different for cached componentRef
deactivate@file:///app/tns_modules/nativescript-angular/router/page-router-outlet.js:105:32 [angular]
deactiveRouteAndOutlet@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4578:30 [angular]
deactiveRouteAndItsChildren@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4538:40 [angular]
deactivateRoutes@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4467:49 [angular]
file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4429:35 [angular]
forEach@[native code] [angular]
deactivateChildRoutes@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4428:36 [angular]
activate@file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4415:35 [angular]
file:///app/tns_modules/@angular/router/./bundles/router.umd.js:4034:30 [angular]
file:///app/tns_modules/rxjs/Observable.js:110:25 [angular]
__tryOrSetError@file:///app/tns_modules/rxjs/Subscriber.js:247:20 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:187:42 [angular]
_next@file:///app/tns_modules/rxjs/Subscriber.js:125:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ScalarObservable.js:49:28 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_complete@file:///app/tns_modules/rxjs/operator/reduce.js:119:34 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_complete@file:///app/tns_modules/rxjs/operator/mergeMap.js:135:38 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ArrayObservable.js:116:32 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyComplete@file:///app/tns_modules/rxjs/operator/every.js:53:30 [angular]
_complete@file:///app/tns_modules/rxjs/operator/every.js:70:28 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_complete@file:///app/tns_modules/rxjs/operator/mergeMap.js:135:38 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ArrayObservable.js:116:32 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyComplete@file:///app/tns_modules/rxjs/operator/every.js:53:30 [angular]
_complete@file:///app/tns_modules/rxjs/operator/every.js:70:28 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_complete@file:///app/tns_modules/rxjs/operator/mergeMap.js:135:38 [angular]
complete@file:///app/tns_modules/rxjs/Subscriber.js:114:27 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ArrayObservable.js:116:32 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ScalarObservable.js:49:28 [angular]
_trySubscribe@file:///app/tns_modules/rxjs/Observable.js:57:35 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:45:40 [angular]
subscribe@file:///app/tns_modules/rxjs/Observable.js:42:26 [angular]
_innerSub@file:///app/tns_modules/rxjs/operator/mergeMap.js:130:55 [angular]
_tryNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:127:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/mergeMap.js:110:26 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
notifyNext@file:///app/tns_modules/rxjs/operator/mergeMap.js:143:34 [angular]
_next@file:///app/tns_modules/rxjs/InnerSubscriber.js:23:31 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_next@file:///app/tns_modules/rxjs/operator/map.js:83:30 [angular]
next@file:///app/tns_modules/rxjs/Subscriber.js:89:23 [angular]
_subscribe@file:///app/tns_modules/rxjs/observable/ScalarObservable.js:49:28 [angular]
```
我遇到这个错误是因为详细信息页面在操作栏中引用了一个对象 属性...(看起来它在操作栏呈现时没有实例化)希望它有帮助
我刚刚在我的属性中添加了一个 *ngIf 来验证它不是未定义的。
示例:
<StackLayout *ngIf="example">
<Label textWrap="true" [text]="example.title"></Label>
<Image [src]="example.image" height="100"></Image>
</StackLayout>