Search
 
SCRIPT & CODE EXAMPLE
 

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()
}
Comment

perent to child data pass in angular

//app.html:
<h1>this is perent component</h1>
<app-child [items]="employee"></app-child>
//app.component.ts:
 employee = {
    id: 1,
    name: 'chintan',
    address: 'junagadh',
  };
//child.component.ts:
@Input() items: any;
//child.html:
<h2>{{ items.id }}</h2>
<h2>{{ items.name }}</h2>
<h2>{{ items.address }}</h2>
Comment

PREVIOUS NEXT
Code Example
Javascript :: what triggers formik validate 
Javascript :: settimeout with loop js 
Javascript :: nginx reverse proxy redirect 
Javascript :: classlist remove multiple classes 
Javascript :: Factorial Recursion Function in Javascript 
Javascript :: react native image with header and body 
Javascript :: deleteicon material ui improt 
Javascript :: return inside for loop javascript 
Javascript :: toast success 
Javascript :: node cron install 
Javascript :: obfuscation js 
Javascript :: new line in javascript string 
Javascript :: mouse position 
Javascript :: flutter response to json 
Javascript :: jquery select2 multiple select all 
Javascript :: get max height from array element jqeury 
Javascript :: date to string format javascript 
Javascript :: how to use buffer in angular by using browserify 
Javascript :: clearinterval javascript 
Javascript :: angular.toJson 
Javascript :: how to create an array in javascript 
Javascript :: maximum number in javascript 
Javascript :: clone a JavaScript object 
Javascript :: how to sum the array values in javascript 
Javascript :: javascript string 
Javascript :: compare date javascript 
Javascript :: react-data-table-component edit action 
Javascript :: recursion mdn 
Javascript :: how to use cookies in react class component 
Javascript :: js set 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =