Question

I'm currently using AngularStrap tabs in a project, and I want the content for one of the tabs to be refreshed every time the tab is shown. I have the tabs set up with

%div(ng-model="tabs.index" bs-tabs="tabs")
  %div(ng-repeat="tab in tabs" data-title="{{tab}}")

and the tab is shown using

%div(ng-show="tabs.active().title == 'Previous Requests'")
  %div(class="outer-tab-content")

However, since ng-show just displays the tab, and doesn't load it every time it's shown, I can't seem to use ng-load to solve this problem. And, since I'm using AngularStrap tabs, I can't figure out how to add an ng-onclick to the tab in question.

Advice?

Was it helpful?

Solution

You can add a watch for your active tab title in your controller code:

$scope.$watch('tabs.active.active().title', function(newValue, oldValue) {
    if(newValue === 'Previous Requests') 
        $scope.tabs.refresh();
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top