Revert "docs: refactor style guide example 03-06 (#24996)"
This reverts commit 65e18dc1bf
.
This commit is contained in:
parent
c205516f0d
commit
d4ac9698ba
|
@ -3,7 +3,7 @@
|
||||||
/* avoid */
|
/* avoid */
|
||||||
|
|
||||||
import { ExceptionService, SpinnerService, ToastService } from '../../core';
|
import { ExceptionService, SpinnerService, ToastService } from '../../core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { Http } from '@angular/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { Hero } from './hero.model';
|
import { Hero } from './hero.model';
|
||||||
|
@ -16,17 +16,17 @@ export class HeroService {
|
||||||
private exceptionService: ExceptionService,
|
private exceptionService: ExceptionService,
|
||||||
private spinnerService: SpinnerService,
|
private spinnerService: SpinnerService,
|
||||||
private toastService: ToastService,
|
private toastService: ToastService,
|
||||||
private http: HttpClient
|
private http: Http
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
getHero(id: number) {
|
getHero(id: number) {
|
||||||
return this.http.get<Hero>(`api/heroes/${id}`).pipe(
|
return this.http.get(`api/heroes/${id}`).pipe(
|
||||||
map(response => response.data as Hero));
|
map(response => response.json().data as Hero));
|
||||||
}
|
}
|
||||||
|
|
||||||
getHeroes() {
|
getHeroes() {
|
||||||
return this.http.get<Hero[]>(`api/heroes`).pipe(
|
return this.http.get(`api/heroes`).pipe(
|
||||||
map(response => response.data as Hero[]));
|
map(response => response.json().data as Hero[]));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
// #docregion example
|
// #docregion example
|
||||||
import { HttpClient } from '@angular/common/http';
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { map } from 'rxjs/operators';
|
import { Http } from '@angular/http';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
import { ExceptionService, SpinnerService, ToastService } from '../../core';
|
|
||||||
import { Hero } from './hero.model';
|
import { Hero } from './hero.model';
|
||||||
|
import { ExceptionService, SpinnerService, ToastService } from '../../core';
|
||||||
// #enddocregion example
|
// #enddocregion example
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -17,17 +16,17 @@ export class HeroService {
|
||||||
private exceptionService: ExceptionService,
|
private exceptionService: ExceptionService,
|
||||||
private spinnerService: SpinnerService,
|
private spinnerService: SpinnerService,
|
||||||
private toastService: ToastService,
|
private toastService: ToastService,
|
||||||
private http: HttpClient
|
private http: Http
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
getHero(id: number) {
|
getHero(id: number) {
|
||||||
return this.http.get<Hero>(`api/heroes/${id}`).pipe(
|
return this.http.get(`api/heroes/${id}`).pipe(
|
||||||
map(response => response as Hero));
|
map(response => response.json() as Hero));
|
||||||
}
|
}
|
||||||
|
|
||||||
getHeroes() {
|
getHeroes() {
|
||||||
return this.http.get<Hero[]>(`api/heroes`).pipe(
|
return this.http.get(`api/heroes`).pipe(
|
||||||
map(response => response as Hero[]));
|
map(response => response.json() as Hero[]));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue