orikoko
orikoko

Reputation: 865

reload html content each time tab selected in angularjs

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?

Upvotes: 0

Views: 942

Answers (1)

mkriheli
mkriheli

Reputation: 1846

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()">

Upvotes: 1

Related Questions