Although a bit late, I would like to post a second approach, since you are using the Ionic-Framework.
If you even have a dynamic number of switch parameters that are controlled by the backend data [Even if you have a static switch, you can convert it to a formal one], Then you should use ionic radio buttons instead:
IE, In your HTML:
<ion-radio ng-repeat="user in userAnswers" ng-value="user.answer" ng-model="finalAnswer"> {{ item.text }} </ion-radio>
And in your controller:
$scope.userAnswers = [ { text: "Backbone", answer: "bb" }, { text: "Angular", answer: "ng" }, { text: "Ember", answer: "em" }, { text: "Knockout", answer: "ko" } ]; $scope.finalAnswer = 'ng';
More information can be found in the official documentation and CodePen Demo
source share