尝试在FirebaseListObservable数组中添加新项,但它说push不是函数
我的阵列:
clients: FirebaseListObservable<any[]>;
这是我的表单提交功能:
onSubmit({value, valid}:{value:Client, valid:boolean}){
if(this.disableBalanceOnAdd){
value.balance = 0;
}
if(!valid){
this.router.navigate(['add-client']);
} else {
// Add new client
this.clientService.newClient(value);
this.router.navigate(['/']);
}
}
这是我的服务:
constructor(public af:AngularFireDatabase) {
this.clients = this.af.list('/clients').valueChanges() as FirebaseListObservable<Client[]>;
}
newClient(client:Client){
this.clients.push(client);
// console.log(client);
}
找不到任何解决方案。任何人都可以帮我解决这个问题吗?