style(docs-infra): clean up Tour-of-Heroes examples (#36483)

I noticed these minor styling issues while aligning the `universal`
examples with the `toh-pt6` example (in a subsequent commit).

PR Close #36483
This commit is contained in:
George Kalpakas 2020-04-15 13:46:47 +03:00 committed by atscott
parent 9f039d40c1
commit 061107c5f6
7 changed files with 13 additions and 15 deletions

View File

@ -19,7 +19,6 @@ button {
padding: 5px 10px;
border-radius: 4px;
cursor: pointer;
cursor: hand;
}
button:hover {
background-color: #cfd8dc;

View File

@ -1,5 +1,5 @@
// #docplaster
// #docregion, v1
// #docregion , v1
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
@ -59,6 +59,5 @@ import { MessagesComponent } from './messages/messages.component';
// #docregion import-httpclientmodule
})
// #enddocregion import-httpclientmodule
export class AppModule { }
// #enddocregion , v1

View File

@ -18,7 +18,7 @@ button {
border: none;
padding: 5px 10px;
border-radius: 4px;
cursor: pointer; cursor: hand;
cursor: pointer;
}
button:hover {
background-color: #cfd8dc;

View File

@ -33,10 +33,10 @@ export class HeroDetailComponent implements OnInit {
this.location.back();
}
// #docregion save
save(): void {
// #docregion save
save(): void {
this.heroService.updateHero(this.hero)
.subscribe(() => this.goBack());
}
// #enddocregion save
// #enddocregion save
}

View File

@ -36,7 +36,7 @@ export class HeroService {
// #docregion getHeroes, getHeroes-1
/** GET heroes from the server */
// #docregion getHeroes-2
getHeroes (): Observable<Hero[]> {
getHeroes(): Observable<Hero[]> {
return this.http.get<Hero[]>(this.heroesUrl)
// #enddocregion getHeroes-1
.pipe(
@ -98,7 +98,7 @@ export class HeroService {
// #docregion addHero
/** POST: add a new hero to the server */
addHero (hero: Hero): Observable<Hero> {
addHero(hero: Hero): Observable<Hero> {
return this.http.post<Hero>(this.heroesUrl, hero, this.httpOptions).pipe(
tap((newHero: Hero) => this.log(`added hero w/ id=${newHero.id}`)),
catchError(this.handleError<Hero>('addHero'))
@ -108,7 +108,7 @@ export class HeroService {
// #docregion deleteHero
/** DELETE: delete the hero from the server */
deleteHero (hero: Hero | number): Observable<Hero> {
deleteHero(hero: Hero | number): Observable<Hero> {
const id = typeof hero === 'number' ? hero : hero.id;
const url = `${this.heroesUrl}/${id}`;
@ -121,7 +121,7 @@ export class HeroService {
// #docregion updateHero
/** PUT: update the hero on the server */
updateHero (hero: Hero): Observable<any> {
updateHero(hero: Hero): Observable<any> {
return this.http.put(this.heroesUrl, hero, this.httpOptions).pipe(
tap(_ => this.log(`updated hero id=${hero.id}`)),
catchError(this.handleError<any>('updateHero'))
@ -136,7 +136,7 @@ export class HeroService {
* @param operation - name of the operation that failed
* @param result - optional value to return as the observable result
*/
private handleError<T> (operation = 'operation', result?: T) {
private handleError<T>(operation = 'operation', result?: T) {
return (error: any): Observable<T> => {
// TODO: send the error to remote logging infrastructure

View File

@ -30,7 +30,7 @@
}
.heroes a:hover {
color:#607D8B;
color: #607D8B;
}
.heroes .badge {
@ -38,7 +38,7 @@
font-size: small;
color: white;
padding: 0.8em 0.7em 0 0.7em;
background-color:#405061;
background-color: #405061;
line-height: 1em;
position: relative;
left: -1px;

View File

@ -1,7 +1,7 @@
// #docregion , init
import { Injectable } from '@angular/core';
import { InMemoryDbService } from 'angular-in-memory-web-api';
import { Hero } from './hero';
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',