Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I get 'Error: Input is not defined' when trying to pass parameter to child component

Tags:

angular

I'm practicing angular2 and i'm really new in it. I built 2 components - a parent and its child. When i'm trying to pass to some parameter from the parent component to its child, I get 'Error: Input is not defined'. Could someone help me with it, because I'm not able to see what i'm doing wrong.

export class SquadComponent{
  @Input() selectedteam;
}

my plunker

like image 985
Joe Avatar asked Mar 10 '23 19:03

Joe


1 Answers

Just import Input before use of it like this

import { Component, Input } from 'angular2/core'

Working example http://plnkr.co/edit/ZXI8FwfYvrcAkTxtUPNy?p=preview

Update

import { Component, Input } from '@angular/core'
like image 76
Pardeep Jain Avatar answered Mar 13 '23 08:03

Pardeep Jain