angular - What is @Input() used for? -
i decided learn angular 4 , follow tutorial @ https://angular.io/tutorial/toh-pt3 but, once again, question arose.
@input () hero: hero;
what for? do? mean?
here code. hero-details.component.ts
import { component, input } '@angular/core'; import { hero } "./hero"; @component({ selector: 'hero-detail', templateurl: './hero-detail.component.html' }) export class herodetailcomponent { @input() hero: hero; }
here code files app.components.ts
, app.components.html
, hero-details.components.html
explain please if can
@input() hero
means hero
variable being passed on component it's parent.e.g
<hero-detail [hero]="(object of hero)"> </hero-detail>
here passing hero object hero
detail component it's parent component.
Comments
Post a Comment