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 :: redux store template 
Javascript :: how to get the index of an object inside of a map js 
Javascript :: js remove undefined object 
Javascript :: disable click extra collapse antd 
Javascript :: select elm inside a specific id in js 
Javascript :: Sub-routes in Main route not getting static files ExpressJS 
Javascript :: get latest journal entry without html 
Javascript :: add a cookie value on postman 
Javascript :: Google App Script Create Contact 
Javascript :: remove json parameter 
Javascript :: Print Files with React 
Javascript :: md5 online decrypt 
Javascript :: Scotch.io - Create a CRUD App with Node and MongoDB 2 App Foundation 
Javascript :: exitBeforeEnter not working 
Javascript :: can javascript sort thai value 
Javascript :: vanilla javascript event when reach bottom of element no jquery 
Javascript :: how to make your own version of filter method 
Javascript :: uploading form data using axios to back end server such as node js 
Javascript :: click outside button angular 
Javascript :: how to difference of arrey object 
Javascript :: RTC measure react native undefined 
Javascript :: Angular active router change event 
Javascript :: discord.js Function to replace certain characters with a pattern 
Javascript :: store in memory an array (two-dimensional) 10rows x 10columns with random integers and show the number of elements between 10 and 20 javvascript 
Javascript :: Backbone Model Set Can Set Muliple Values At Once 
Javascript :: regex to allow spaces and characters 
Javascript :: hsv to rgb js 
Javascript :: axios params onclick function 
Javascript :: HSET redis, HINCRBYFLOAT redis 
Javascript :: js Changing selected option by option id, class, or attribute 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =