Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

angular passing data to child component

Parent component:
<app-child-component [item]="data"></app-child-component>

Child component.ts
import { Component, Input } from '@angular/core'; // First, import Input
export class ItemDetailComponent {
  @Input() item = ''; // decorate the property with @Input()
}
Source by angular.io #
 
PREVIOUS NEXT
Tagged: #angular #passing #data #child #component
ADD COMMENT
Topic
Name
6+1 =