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; }
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
Post a Comment