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