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 :: last index of javascript 
Javascript :: javascript splice without changing array 
Javascript :: javascript extend array 
Javascript :: javascript get same elments from multiple arrays 
Javascript :: js tolowercase 
Javascript :: string to jspn js 
Javascript :: javascript last child 
Javascript :: var notification = new Notification 
Javascript :: react native run ios 
Javascript :: flutter print json 
Javascript :: js array add every element of array 
Javascript :: javascript returning a function 
Javascript :: react focus textarea 
Javascript :: react script 
Javascript :: accessing object properties with bracket notation 
Javascript :: how to use uniqid 
Javascript :: define an unsigned int js 
Javascript :: alpinejs with select 
Javascript :: get timezone name from date javascript 
Javascript :: domparser is not defined 
Javascript :: javascript currency format 
Javascript :: run function then empty it 
Javascript :: bubble sort js 
Javascript :: how to filter list of objects by an array in javascript 
Javascript :: merge objects js 
Javascript :: dotenv not loading process.env in node 
Javascript :: how to compare objets in an array 
Javascript :: connect mysql to node js 
Javascript :: Converting string to json object 
Javascript :: array of images javascript 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =