Last active
October 21, 2016 19:02
-
-
Save wKoza/3fbafada31ba5dd0791139452163d51b 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
import {Component} from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
template: ` | |
<div [align]="alignement" [ngStyle]="{color:couleur}">Personne : {{person}} | Age : {{age}} | Adresse : {{address.street}}</div> | |
<app-comp1 [monAdresse]="address"></app-comp1> | |
<button (click)="modifierPersonne()">Modifier adresse</button> | |
<h1>Event binding - Compteur</h1> | |
<div><app-comp2 (counterChange)="myValueChange($event);"> </app-comp2></div><br/> | |
<div>Valeur récupérée : {{compteur}}</div> | |
` | |
}) | |
export class AppComponent { | |
person: string= 'John Doe'; | |
age: number= 30; | |
address: any= {street: 'rue du Paradis', city: '75010 Paris'}; | |
alignement: string = 'right'; | |
couleur: string = 'red'; | |
compteur: any = 'N/A'; | |
myValueChange (event) { | |
this.compteur = event.value; | |
} | |
modifierPersonne () { | |
this.person = 'Another man'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment