Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Confused in how to implement tab based app with angular ui-router (like gmail)

I was thinking last night about how to port our crud application to a tab based app, like gmail. First, reading a lot about ui-router, i thought in create a tabService that will create a new tab for each state change (listen $rootScope.stateChangeSuccess), the new tab would include the corresponding view (ui-view="bancos") that will display the state template.

My first test and my first problem, when shown the list of items, a click over one of the item (itemId=4 for example) should open a new tab and display the item with id=4 in this tab, inside the corresponding (ui-view="bancos/4"). Note how i'm trying to map named ui-view with states to display the state defined templates in the corresponding ui-view.

I know that ui-router sample seems to do what i'm trying, but they are using nested states with unamed ui-view inside parent state template. In my case, the parent state ui-view element and his child state ui-view element should be sibling.

Considering the nature of angular, tree structured, and the nature of ui-router states, tree structured too, can i use ui-router to implement my requirements (crud application with tab based design).

Regards Danny

like image 642
d_a_g_a_h_e Avatar asked Nov 01 '22 14:11

d_a_g_a_h_e


1 Answers

Here is me example, if you have questions i can answer

http://plnkr.co/edit/tqfPVFaesSe9Q6ZkPMzE?p=preview

Short explain: don't use tabs instead of that create a fake, works well and you save a lot of work.

Best

like image 115
Alfonso Avatar answered Nov 08 '22 04:11

Alfonso