angular5之后使用pipe
this.http.get('url') .pipe( timeout(1000), catchError(e => { return of(null); }) ).toPromise().then( res => { //成功 }).catch(e => { //报错 );