AngularJS UI Bootstrap Tabs that support routing

42,167

Solution 1

To add routing you typically use an ng-view directive. I'm not sure it's easy enough to modify angular UI to support what you're looking for, but here's a plunker showing roughly what i think you're looking for (it's not necessarily the best way of doing it - hopefully someone can give you a better solution or improve on this)

Solution 2

Use data-target="#tab1". Worked for me

Solution 3

This answer really helped me http://odetocode.com/blogs/scott/archive/2014/04/14/deep-linking-a-tabbed-ui-with-angularjs.aspx (very simple but powerful solution)

Solution 4

I also have this requirement and I'm doing something similar to the answer provided by Chris, but I'm also using AngularUI router, because ngRouter does not support nested views and it is possible you'll have the tabs content view inside another view (I did) and that won't work with ng-view.

Solution 5

you could pass your own custom key value pairs in the route definition and achieve this. here's a good example: http://www.bennadel.com/blog/2420-Mapping-AngularJS-Routes-Onto-URL-Parameters-And-Client-Side-Events.htm

Share:
42,167
Misha Moroshko
Author by

Misha Moroshko

I build products that make humans happier. Previously Front End engineer at Facebook. Now, reimagining live experiences at https://muso.live

Updated on July 07, 2020

Comments

  • Misha Moroshko
    Misha Moroshko almost 4 years

    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?