How do I make a directive with a property in Angular 2? -


i don't understand how make component property. can see what's matter?

i keep getting error: "can't bind 'val' since isn't known native property"

// app.html

there should list of fruit here line after each 1 <ul>   <template ngfor let-fruit [ngforof]="fruits">     <li>{{fruit}}</li>     <part [val]="5"></part>   </template> </ul> 

and

part.component.ts

import { component } '@angular/core';  @component({   selector: 'part',   templateurl: 'app/part.html' }) export class partcomponent {    // meaningless now. want thing    // take parameter   val: number; } 

plunk

if may allowed suggest, plunk provided angular team demonstrates common features of technology (like these in plunk form , more basic) way more useful me the documentation. if know of such thing, i'd grateful referral.

you need declare child directives in main component. add directives:[partcomponent] appcomponent's meta data. , @input() needed val property.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -