我试图在 angular7 中使用 web api 获取数据,但我面临 [object object] 问题。
auth.service.ts
getCareer(){
return this._HttpClient.get('http://localhost:49345/api/website/getCarrier');
}
组件.ts
export class careerComponent implements OnInit{
getCareer$: object;
constructor(private _AuthService: AuthService){ }
ngOnInit(){
this._AuthService.getCareer().subscribe(
data => this.getCareer$ = data
);
}
}
组件.html
<div class="col-xl-6" *ngFor="let career of getCareer$">
<h2>test</h2>
<h3>{{career.designation}}</h3>
</div>
问题/控制台屏幕截图
API 截图
我该如何解决?