How to correctly add more than one ion-radio to a template?

Asked

Viewed 33 times

0

I’m having trouble adding more than one ion-radio to a template.

I have a screen with an ion-radio that is working accordingly. However I need to add a few more and I am finding problems.

When I change the dial of the first radio, it works accordingly. But if I check an option from the other radio, it is unchecking the selection of the (s) too, What to do to solve?

Here are the codes I’m using:

<ion-radio 
     ng-repeat="report in config.relatorios" 
     ng-value="report.value" 
     ng-model="config.selecao.relatorio">    

     {{report.name}}

</ion-radio>

<ion-radio 
    ng-repeat="menu in config.menu" 
    ng-value="menu.value" 
    ng-model="config.selecao.menu">

    {{menu.name}}

</ion-radio>


 vm.menu = 
        [
            { name: 'Grid (Quadrado)', value: 'quadrado' }, 
            { name: 'Lista', value: 'lista' }, 
            { name: 'Grid (Circulo)', value: 'circulo' }
        ];

 vm.relatorios = 
         [
            { name: 'Diário', value: 'diario' }, 
            { name: 'Mensal', value: 'mensal' }
        ];

 vm.selecao = {
                menu: 'lista',
                relatorio: 'diario',
            };

  • 1

    I added the property and solved. thanks anyway, If you want to add as answer, I mark as correct dai =)

1 answer

1


I already had this problem and I managed to solve by simply putting the name property in the ion-radio.

<ion-radio ng-repeat="menu in config.menu" ng-value="menu.value" ng-model="config.selecao.menu" name="1"> {{menu.name}} </ion-radio>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.