标签:vat table mode model ror params exp cto xxx
import { HttpClient, HttpErrorResponse, HttpParams } from ‘@angular/common/http‘;
@Injectable({
providedIn: ‘root‘
})
export class XXX {
constructor(
private readonly http: HttpClient) { }
getXXX(): Observable<ModelClass> {
return this.http.get<ModelClass>("url").pipe(
catchError((err) => this.handleError(err)));
}
getYYY(page: number = 0, size: number = 10): Observable<Array<ModelClass>> {
const params = new HttpParams()
.set(‘page‘, String(page))
.set(‘size‘, String(size));
return this.http.get<any>("url", { params }).pipe(
map(response => response.assetList as Array<ModelClass>),
catchError(err => this.handleError(err, of([] as Array<ModelClass>)))
);
}
}
标签:vat table mode model ror params exp cto xxx
原文地址:https://www.cnblogs.com/wyp1988/p/12574574.html