Doubly nested views : UI-Router or UI-Bootstrap tabs / accordion?


I am a total Angular (and JS) beginner.

I want to develop something like this:

enter image description here

(with apologies to @PhillipKregg for borrowing his excellent illustration).

Effectively, I want nested tabbed notebooks – a row of tabs (views?), each which can contain data or another row of tabs (each of which …).

Googling seems to return more recommendations for UI-Router, but I imagine that UI-Bootstrap’s Tabs or Accordion could also be used (or even UI-Bootstrap’s Pagination, with a single view whose contents I update according to the selected page?).

All else being equal, I will go with whichever is easiest for a novice to understand and implement (which is that?).

But – are there performance issues? For instance, will one download the content of all the views immediately or initial page load (thus increasing initial page download time)? Will one only download the data for a view when it becomes active (which seems preferable)?

Anything else I need to consider?


Yes, ui-router & ui-bootstrap.tabs are the best tools for the job at the moment. To do something similar would require mixing two types of ui-router config patterns, nest views & multiple named views. I’d suggest reading both these wiki pages:

Here’s a basic draft demo of something similar to your illustration, using ui-router & ui-bootstrap.tabs:

The easiest way to get started is to use ng-boilerplate, it uses ui-router & has best-practice directory structure. It also addresses performance issues by compiling html to js & adding templates to $templateCache, thus kicking lots of XHR requests to the curb.

Regards to data downloads, data would typically be managed by a angularJS service singleton instance, separate from any views. How & when you invoke any service from any view is totally your choice. This is a pretty good tutorial on angular services:

Answered By – cheekybastard

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published