Created
January 21, 2019 22:31
-
-
Save latish/fece4e0828587f254d0088f3e5027033 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div *ngIf="hero"> | |
<h2>{{ hero.name | uppercase }} Details</h2> | |
<div><span>id: </span>{{ hero.id }}</div> | |
<div> | |
<label>name: <input [(ngModel)]="hero.name" placeholder="name" /> </label> | |
</div> | |
<button (click)="goBackClicked()">go back</button> | |
<button (click)="saveClicked()">save</button> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Input, Output, EventEmitter } from '@angular/core'; | |
import { Hero } from '../hero'; | |
@Component({ | |
selector: 'app-hero-detail-ui', | |
templateUrl: './hero-detail.component.html', | |
styleUrls: [ './hero-detail.component.css' ] | |
}) | |
export class HeroDetailComponent { | |
@Input() hero: Hero; | |
@Output() goBack= new EventEmitter(); | |
@Output() save= new EventEmitter<Hero>(); | |
goBackClicked(): void { | |
this.goBack.emit(); | |
} | |
saveClicked(): void { | |
this.save.emit(this.hero); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment