Try do it:
view:
< ion-radio ng-repeat="user in userAnswers" ng-value="user.answer" ng-model="finalAnswer">{{ user.text }}< /ion-radio>controller:
$scope.userAnswers = [
{ text: "Backbone", answer: "bb" },
{ text: "Angular", answer: "ng" },
{ text: "Ember", answer: "em" },
{ text: "Knockout", answer: "ko" }
];
$scope.finalAnswer = 'ng';I think the ionic 2 is something like:
export class MainCtrl{
constructor(){
this.userAnswers = [
{ text: "Backbone", answer: "bb" },
{ text: "Angular", answer: "ng" },
{ text: "Ember", answer: "em" },
{ text: "Knockout", answer: "ko" }
];this.finalAnswer = 'ng'; }
}
http://ionicframework.com/docs/v2/components/#radio
https://github.com/driftyco/ionic-site/tree/master/dist/preview-app/app/inputs/radio
↧
Ion-radio with checked="true" does not work?
↧