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; padding: 5px 10px;
border-radius: 4px; border-radius: 4px;
cursor: pointer; cursor: pointer;
cursor: hand;
} }
button:hover { button:hover {
background-color: #cfd8dc; background-color: #cfd8dc;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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