Created
August 24, 2018 10:43
-
-
Save DonkeyKongJr/19c7c0246ef7d6a3246d8c3b393eeaba to your computer and use it in GitHub Desktop.
Parent Component
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 style="text-align:center"> | |
<h1> | |
Welcome to {{ title }}! | |
</h1> | |
<label >Parent Component Input: </label> | |
<input type="text" [(ngModel)]="textInput"> | |
<p>Child Value is: {{childValue}}</p> | |
<app-child [parentInput]="textInput" (childOutput)="updatedChildValue($event)"></app-child> | |
</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 } from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.css'] | |
}) | |
export class AppComponent { | |
textInput = ''; | |
childValue = ''; | |
title = 'app'; | |
public updatedChildValue(value: string){ | |
this.childValue = value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment