我是Angular的新手,正在使用Angular 6构建应用程序。我面临的问题是,该应用程序花费大量时间从我的第一个API调用中加载数据。尽管在随后的请求中数据显示非常快。有什么方法可以快速加载数据,甚至在加载数据时以块的形式显示数据?
这就是我从服务中的webApi获取数据的方式:-
getByKey(key:string) :Observable<IClient[]>
{
return this._http.get<IClient[]>(this.baseUrl+"/getByKey/"+key);
}
这是我调整服务方法的方式:-
public getSearchKey(): void {
this._clientService.getByKey(this.searchKey).subscribe(clientData => this.clients = clientData, error => {
console.error(error)
},()=>this.loaded=true);
}
使用this.client我正在表中显示数据。
谢谢