Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab for current route not set to active using Bootstrap.UI 1.2.4 #70

Closed
mjbeswick opened this issue Mar 15, 2016 · 10 comments
Closed

Tab for current route not set to active using Bootstrap.UI 1.2.4 #70

mjbeswick opened this issue Mar 15, 2016 · 10 comments

Comments

@mjbeswick
Copy link

The latest version of Bootstrap.UI 1.2.4 breaks the functionality setting the tab matching the current route. Works with previous version Bootstrap.UI 1.2.

I have stepped though the ui-router-tabs.js, and isAncestorOfCurrentRoute is being set to true for the correct tab, although when the page finishes loading, the first tab is always set to active.

@rpocklin
Copy link
Owner

Yep, looks like there's a bit of work to do with this new version of Bootstrap.UI.

@ulejon
Copy link

ulejon commented Mar 18, 2016

Having the same issue, using Bootstrap UI 1.2.1.
Any idea when this can be fixed?

@primavera133
Copy link

I have the same issue with Bootstrap UI 1.2.2. It seems Bootstrap UI moved the active-attribute to the uib-tabset element, and the value of it should be the active tab index.

@primavera133
Copy link

Close to presenting a fix now but it breaks the tests for $stateChangeStart cancel that still routes. Cannot see why my code would break that, so it's probably something with the UI-update. No more time to spend on it at the moment, though... :/
ui-router-tabs.js.zip

@rpocklin
Copy link
Owner

Can't do much with a zip, presenting a branch from your repo (forked from this) would have been a better way to go.

@primavera133
Copy link

Yeah, sorry about that. Will see if I can get some time to do this better.

@rpocklin
Copy link
Owner

Please test out using the master branch, if it's all good I will release it.

@dcheney
Copy link

dcheney commented Apr 29, 2016

As Bootstrap UI moved the active attribute to the uib-tabset element (thanks primavera133!), a patch to ui-router-tabs.js that works for me is:

        $scope.update_tabs = function() {
          // sets which tab is active (used for highlighting)
          angular.forEach($scope.tabs, function(tab, index) {         // include index
            tab.params = tab.params || {};
            tab.options = tab.options || {};
            tab.active = $scope.active(tab);
            if ($scope.active(tab)) { $scope.tabs.active = index; }   // record index
          });
        };

and then use 'active=tabs.active' in the template:

    var DEFAULT_TEMPLATE = '<div><uib-tabset class="tab-container" type="{{type}}" vertical="{{vertical}}" active=tabs.active ' +
      'justified="{{justified}}">' + '<uib-tab class="tab" ng-repeat="tab in tabs" heading="{{tab.heading}}" ' +
      'active="tab.active" disable="tab.disable" ng-click="go(tab)">' +
      '</uib-tab></uib-tabset></div>';

@rpocklin
Copy link
Owner

Thanks for the suggestion, am working to release a new version this week.

@rpocklin
Copy link
Owner

Released v2.0.0, feel free to raise any issues against it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants