我如何在angular7中的html模板中实现订阅>

问题描述 投票:0回答:2
[getEmployee()是我的服务页面中的一种方法,现在我希望使用HTML模板在我的组件中没有订阅showEmployee()方法的员工列表。

showEmployee(){ this.employeeModel= this._empService.getEmployee(); }

getEmployee()是我的服务页面中的一种方法,现在我希望使用HTML模板在我的组件中不使用subscribe showEmployee()方法的雇员列表。 showEmployee(){this.employeeModel = ...
angular7
2个回答
0
投票
so u need the pipe in html <p *ngFor="let data as employeeModel | async"> <span> {{data.empName}}</span> </p>

0
投票
employeeModel : Observable<any>
© www.soinside.com 2019 - 2024. All rights reserved.