在nativescript(Angular)中,我正在使用(nativescript-angular / router)和(nativescript-plugin-firebase)
当我写这样的代码(订单页面var绑定不起作用):
firebase.addValueEventListener(result => {
this.router.navigate(['/order'], { clearHistory:true });
}, path);
and this is the simulator image of the order page when the code is inside the listener
但是当路由代码在事件监听器之外时,它就可以工作
this.router.navigate(['/order'], { clearHistory:true });
firebase.addValueEventListener(result => {}, path);
and this when the code is outside... the var value shows in the template perfectly fine
这是模板代码 order.html
<Label [text]="test"></Label>
这是 order.component.ts
export class OrderComponent {
public test = "test var value";
}
1 回答
将导航包装在Angular分区回调中 .