【发布时间】:2018-02-07 15:32:02
【问题描述】:
当我从带有参数的数据库中获取对象时出现此错误:
代码组件:
constructor(public employeeService:EmployeeService, public router:Router, public activatedRoute:ActivatedRoute) { }
ngOnInit() {
this.email = this.activatedRoute.snapshot.params['email'];
this.employeeService.getEmployee(this.email).subscribe(employee => {
if (employee.salary >0) { this.hasSalary = true;}
this.employee = employee;
console.log(this.employee);
});
}
代码服务:
getEmployee(email:string)
{
return this.item = this.af.object('employeesdb/'+email).valueChanges() as FirebaseObjectObservable<Employee>;
}
【问题讨论】:
标签: angular firebase angularfire angularfire2