I'm currently trying the FormBuilder and ControlBindings (ng-control) of Angular2 (Alpha 27). I'm trying to bind some RadioButtons with the ng-control, but i can't get it to work.
My Controller contains following Code for my Form:
this.colours = [{text:"red"}, {text:"green"}, {text:"blue"}];
this.myForm = builder.group({
someText: [""],
someColour: ["blue"]
});
On my view i tried following:
<p *ng-for="var colour of colours">
<input id="{{colour.text}}" name="someColour" type="radio"
ng-control="someColour"
[checked]="myForm.controls.someColour.value == colour.text">
<label for="{{colour.text}}">{{colour.text}}</label>
</p>
The problem seems to be, that ng-control sets the predefined value of someColor
on every one of my radio-buttons. A click on one of the other RadioButtons works, but the bound Value is not changed. So that a label bound to the value of my ng-control will never show another value, than the predefinied value "blue".
Hope anyone has a Solution for this, using ng-control.
P.S.: I know i can bind the RadioButton to a property of my Controller and Change the value by ClickBinding, but that's not the solution i'm looking for.