AngularJS UI Bootstrap Tabs that support routing

5,181 views
Skip to first unread message

Misha Moroshko

unread,
Jun 1, 2013, 9:13:01 AM6/1/13
to ang...@googlegroups.com
I would like to use AngularJS UI Bootstrap Tabs in my project, but I need it to support routing.

For example:

    Tab         URL
    --------------------
    Jobs       /jobs
    Invoices   /invoices
    Payments   /payments

As far as I can tell from the source code, the current tabs and pane directives doesn't support routing.

What would be the best way to add routing?

Grant Rettke

unread,
Jun 1, 2013, 9:41:17 PM6/1/13
to ang...@googlegroups.com
On Sat, Jun 1, 2013 at 8:13 AM, Misha Moroshko
<michael....@gmail.com> wrote:
> I would like to use AngularJS UI Bootstrap Tabs in my project, but I need it
> to support routing.

I'm working on this right now. Its scope is pretty limited. When I
define my routes, I include the roles that can access them, the
visibility of them when you are not logged in, their order, and
whether or not they should be displayed in a menu or tabs. It isn't
perfect, but it is a start from a UI perspective.

Andy Joslin

unread,
Jun 2, 2013, 9:39:41 AM6/2/13
to ang...@googlegroups.com
It seems like you don't really need a full-fledged tabs directive for this.

<div class="tabbable">
  <ul class="nav nav-tabs">
    <li ng-class="{active: currentRoute=='jobs'}">
      <a href="/jobs">Jobs</a>
    </li>
    <li ng-class="{active: currentRoute=='invoices'}">
      <a href="/invoices">Invoices</a>
    </li>
    <li ng-class="{active: currentRoute=='payments'}">
      <a href="/invoices">Payments</a>
    </li>
  </ul>
  <div class="tab-content" ng-view></div>
</div>

Done :-)

David Gee

unread,
Jun 3, 2013, 1:41:36 AM6/3/13
to ang...@googlegroups.com
Yep, that's definitely the way to go. Just use the Bootstrap CSS for a tabs effect, I think the Bootstrap-UI tabs directive is really more suited for static content.

Marcel Klemenz

unread,
Sep 18, 2013, 5:05:20 AM9/18/13
to ang...@googlegroups.com
I currently have the same problem. I solved it partialy by using a div as tabcontent with ng-include for the template and ng-controller for the controller.
The main problem is, that I need the resolve-functionality from the routing mechanism. My Controllers must have specific objects available when they initialize. They cannot get them themselfs, so the tab must not open and the controller must not initialize if the resolve mechanism could not get all dependencies.

Does anyone have an idea how to accomplish this?
Reply all
Reply to author
Forward
0 new messages