angular - Name for radio group -


i'm trying setup name radio group elements. doesn't work. here component:

@component({     templateurl: "page.html" }) export class fieldcomponent {      @input() control: control;     @input() value: string;     @input() label: string; } 

here template:

{{label}} <input type="radio" name="{{label}}" [value]="true" [ngformcontrol]="control" /> <input type="radio" [name]="label" [value]="true" [ngformcontrol]="control" /> <input type="radio" name="abc" [value]="false" [ngformcontrol]="control" /> 

{{label}} works ok. did test.

but why name="{{label}}" , [name]="label" not works. when hardcode name="abc" can see name in html.

thanks

<input type="radio" [attr.name]="label" [value]="true" [ngformcontrol]="control" /> 

you can use [attr.attrname] attribute binding. can more info attribute directives here.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -