Quantcast
Viewing all articles
Browse latest Browse all 229906

Radio Button Values Not Restored When View Caching Switched On

Wow I feel stupid. I realized it's because of the missing name attribute each set of radio buttons are being grouped together. So when you select one, the selection from a previous group is lost. Disabling caching hides the problem because the view div with the previous group is removed from the DOM.

Simple fix is to add name:

<div class="list">
    <ion-radio-fix name="formdata.mobility" ng-model="formdata.mobility" value="1">ABC</ion-radio-fix>
    <ion-radio-fix name="formdata.mobility" ng-model="formdata.mobility" value="2">DEF</ion-radio-fix>
    <ion-radio-fix name="formdata.mobility" ng-model="formdata.mobility" value="3">GHI</ion-radio-fix>
    <ion-radio-fix name="formdata.mobility" ng-model="formdata.mobility" value="4">JKL</ion-radio-fix>
    <ion-radio-fix name="formdata.mobility" ng-model="formdata.mobility" value="5">MNO</ion-radio-fix>
</div>

Note that name can be anything, as long as it's unique to that group of radio buttons.


Viewing all articles
Browse latest Browse all 229906

Trending Articles