docs(toh): add missing snippets

closes #1649
This commit is contained in:
Foxandxss 2016-06-11 19:55:43 +02:00 committed by Ward Bell
parent fd46bf4970
commit 61ad427319
2 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,8 @@
// #docplaster // #docplaster
// #docregion // #docregion, variables-imports
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
// #enddocregion variables-imports
import { RouteParams } from '@angular/router-deprecated'; import { RouteParams } from '@angular/router-deprecated';
import { Hero } from './hero'; import { Hero } from './hero';
@ -11,11 +13,13 @@ import { HeroService } from './hero.service';
templateUrl: 'app/hero-detail.component.html', templateUrl: 'app/hero-detail.component.html',
styleUrls: ['app/hero-detail.component.css'] styleUrls: ['app/hero-detail.component.css']
}) })
// #docregion variables-imports
export class HeroDetailComponent implements OnInit { export class HeroDetailComponent implements OnInit {
@Input() hero: Hero; @Input() hero: Hero;
@Output() close = new EventEmitter(); @Output() close = new EventEmitter();
error: any; error: any;
navigated = false; // true if navigated here navigated = false; // true if navigated here
// #enddocregion variables-imports
constructor( constructor(
private heroService: HeroService, private heroService: HeroService,

View File

@ -217,6 +217,11 @@ code-example(language="bash").
Loading heroes using `Http` required no changes outside of `HeroService`, but we added a few new features as well. Loading heroes using `Http` required no changes outside of `HeroService`, but we added a few new features as well.
In the following section we will update our components to use our new methods to add, edit and delete heroes. In the following section we will update our components to use our new methods to add, edit and delete heroes.
Before we can add those methods, we need to initialize some variables with their respective imports.
+makeExample('toh-6/ts/app/hero-detail.component.ts', 'variables-imports', 'app/hero-detail.component.ts')(format=".")
:marked
### Add/Edit in the *HeroDetailComponent* ### Add/Edit in the *HeroDetailComponent*
We already have `HeroDetailComponent` for viewing details about a specific hero. We already have `HeroDetailComponent` for viewing details about a specific hero.