Created
May 15, 2017 19:41
-
-
Save squadwuschel/420c596ae1f0caf8616b4a2191b3a0d4 to your computer and use it in GitHub Desktop.
two-way-databinding Angular
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: 'my-app', | |
template: `<p>V1 Parentvalue Name: "{{firstname}}"<br/><input [(ngModel)]="firstname" > <br/><br/> | |
V2 Parentvalue Age: "{{alter}}" <br/><input [(ngModel)]="alter"> <br/><br/> | |
<my-child [(name)]="firstname" [age]="alter" (ageChanged)="alter = $event"></my-child></p>` | |
}) | |
export class AppComponent { | |
firstname = 'Angular'; | |
alter = "18"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment