Angular Property Binding - Child Component
<p>Parent Input is: {{parentInput}} </p> | |
<label >Child Component Input: </label> | |
<input type="text" [ngModel]="childTextValue" (ngModelChange)="updateOutput($event)"> |
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; | |
@Component({ | |
selector: 'app-child', | |
templateUrl: './child.component.html', | |
styleUrls: ['./child.component.css'] | |
}) | |
export class ChildComponent implements OnInit { | |
@Input() parentInput: string; | |
@Output() childOutput = new EventEmitter<string>(); | |
childTextValue = ''; | |
constructor() { } | |
ngOnInit() { | |
} | |
updateOutput(value) { | |
this.childOutput.emit(value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment