0

I am using tabset (AngularUI)

  <tabset justified="true">
    <tab heading="Justified">my html content</tab>
    <tab heading="SJ">Short Labeled Justified content</tab>
    <tab heading="Long Justified">Long Labeled Justified content</tab>
  </tabset>

my html content is dynamic data that I am loading from database, this page is editable and have save button. If I am editing the data and don't press on the save button and than I am going to another tab and back to my tab I don't want to see the edited data, I want to see the loaded data again, till I am pressing "Save". that means that I need to load all my data and page each time I select tab (start the controller). What is the best and correct way to do it?

1 Answer 1

1

You can define for each tab the select attribute, which can call a function on your scope. Here's the relevant part from the docs:

select() (Defaults: null) : An optional expression called when tab is activated.

And part from their example:

 <tab select="alertMe()">
Sign up to request clarification or add additional context in comments.

4 Comments

so, the correct thing to do here is to call the function in my controller that loads my page again? I tried to do this, but the problem is that the validators from my last visit in this page keep to show(I have form validation that show green/red on my inputs)
Yep, load and update the displayed content in the relevant tab (probably a scope var).
I see....Is there a fast and good way to reset my html5 validators? they keep displaying on my page even after uploading the data again. thank you very much
You mean angular's form validation ? If so, try to set the form to a pristine mode, see: docs.angularjs.org/api/ng/type/form.FormController#$setPristine

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.