Angular 如何将我的应用迁移到httpClient?

Angular 如何将我的应用迁移到httpClient?,angular,httpclient,Angular,Httpclient,这里我有我服务的方法 getEmployees() { let _url: string = this.API_URL + '/organization/1/users'; return this._http.get(_url) .map(res => res.json().data) .catch(this._errorHandler); } 并调用我的app.component.ts生成我的用户列表 ngOnInit() {

这里我有我服务的方法

getEmployees() {
    let _url: string = this.API_URL + '/organization/1/users';
    return this._http.get(_url)
        .map(res => res.json().data)
         .catch(this._errorHandler);
}
并调用我的app.component.ts生成我的用户列表

ngOnInit() {
    this._usermanagementservice.getEmployees().subscribe(employees => {
    this.employees = employees; 
    });

}

它可以工作,但我必须迁移到angular的当前版本并使用HttpClient,我被卡住了,请帮助:(

这就是我的样子,使用HttpClient和新的“可管道”操作符

import { catchError, tap, map } from 'rxjs/operators';

getMovies(): Observable<IMovie[]> {
    return this.http.get<IMovie[]>(this.moviesUrl).pipe(
        tap(data => console.log(JSON.stringify(data))),
        catchError(this.handleError)
    );
}
从'rxjs/operators'导入{catchError,tap,map};
getMovies():可观察{
返回this.http.get(this.moviesUrl).pipe(
点击(data=>console.log(JSON.stringify(data)),
catchError(this.handleError)
);
}

订阅语法没有改变。

试试!哈哈,谷歌怎么了?有没有相关的源代码?你是否也在使用最新的rxjs运营商?