Skip to content

Instantly share code, notes, and snippets.

@DonkeyKongJr
Created August 24, 2018 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DonkeyKongJr/19c7c0246ef7d6a3246d8c3b393eeaba to your computer and use it in GitHub Desktop.
Save DonkeyKongJr/19c7c0246ef7d6a3246d8c3b393eeaba to your computer and use it in GitHub Desktop.
Parent Component
<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>
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