0

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?

4
  • Need to explain the page refresh in more detail. Reload view or reload whole page? Commented Jan 29, 2016 at 15:22
  • need to store data in a service if you want that same data available when view changes Commented Jan 29, 2016 at 16:38
  • 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. Commented Jan 29, 2016 at 16:46
  • Need to see how service and controller work then Commented Jan 29, 2016 at 16:49

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Yes, that's wan I want, reset the input's value!
Actually the topRadio function is set to make topCategory the default value, when i load the view the category radio button is checked, the thing is when I move to any of the other two, and then change the filters and click on the apply button the view reloads and stay in the second or third radio depending on my selection and what I want is to go to the firs radio..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.