In the codepen below you can type text in the input field and it will appear in the scope. When you select a gender, it won’t show up in the same scope.
I have two questions here: how can I have the gender show up in the scope and how can I select one of the radio’s as the default selected one.
When using “normal” radio buttons, everything works well.
<input type="radio" ng-model="formData.color" value="red"> Red
<input type="radio" ng-model="formData.color" value="blue"> blue
Thanks for helping out, I’m rather new to both angular and ionic.
Few things, when using ng-model, you need to use ng-value. Also, ng-value is parsed by angular, so for strings you have to wrap it in extra quotes like: ng-value="‘red’". Lastly, angular directives like ion-radio have their own scope, so to get in the main controller’s scope, you have to reference $parent.formData.gender. Here’s an example.
I think I figured out, it works but only if you use an object like $parent.object.value, because if you use something like $parent.value the model it won’t be updated.