在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";
}
答案 0 :(得分:0)
将导航包装在Angular zoned回调中。
hide()