It's mostly AngularJS, not Ionic. When you initialize your array of items that will be used in the select, set item.checked = true; See line 164 in the js source and lines 78+ in the HTML source in the codepen.
<script>
var $scope.countries = [
{id: 1, name: 'United States', checked: true},
{id: 2, name: 'Germany', checked: false}
]
</script>
<ion-toggle
ng-repeat="item in items"
ng-if="multiSelect"
ng-checked="item.checked"
ng-model="item.checked"
class="item item-text-wrap">
If you want to do it with the single select, you'll have to add an angular expression that sets a css class:
ng-class="{selected : item.checked}"
So the label becomes:
<!-- Single select -->
<label
ng-repeat="item in items"
ng-if="!multiSelect"
class="item item-text-wrap"
ng-class="{selected : item.checked}"
ng-click='validateSingle(item)'>
Add a class to your stylesheet to highlight selected countries when the modal opens:
.selected {
background-color: red !important;
}
And if you want to have the selected country appear as the label for the fancy select, something like this would/could work:
$scope.countries_text_single = $scope.countries[0].name;