0
votes

I have a set of radio buttons that when I click them they show different content.

<div class="radio" ng-init="topRadios()">
 <input type="radio" ng-model="topTable" value="topCategory" ng-change="updateTotals('topCategory')">TY  30 Categories</label>
 <input type="radio" ng-model="topTable" value="topSupplier" ng-change="updateTotals('topSupplier')">TY Top 10 Suppliers</label>
 <input type="radio" ng-model="topTable" value="topBrand" ng-change="updateTotals('topBrand')">TY Top 10 Brands</label>

</div>

And I have a button to apply some filters to the information that is displayed depending o the radio button selection.

 <button class="goButton btn btn-xs" ng-class="css" ng-click="go()" ng-disabled="isClicked"> Apply </button>

When I click on the third button to see that info for example and then the Apply button with some filters the page refresh and what I want is that when the info and radio buttons displayed the first radio button is selected.

Can anyone help me please?

1
Need to explain the page refresh in more detail. Reload view or reload whole page? - charlietfl
need to store data in a service if you want that same data available when view changes - charlietfl
actually it's stored in a service, when I click the apply button returns differente data, but what I want is to reload the radio buttons and see the info of the first radio. - kennechu
Need to see how service and controller work then - charlietfl

1 Answers

1
votes

sounds like what you want to do is set an initial value for your radio input's ng-model in your controller:

$scope.topTable = 'topCategory';

you probably also want to reset the input's value in your go function after you apply your filtering with that same code snippet.