0

I am using custom Directive's approach in AngularJS for making dashboard with widgets and for widgets m using angular-gridster (https://github.com/ManifestWebDesign/angular-gridster).

Requirements:

enter image description here

On right side menu created by custom directive is present.and for routing purpose UI Router in used.

1-I need to open a dashboard firstly empty.

2-when click to Menu1 one widget is opened with data from state menu1 and same for Menu2

3-when 2nd option is clicked another widget added to dashboard without affecting previously opened one and so on.

4-all the widgets have independent data.and navigation in each widget is according to the respective menu.

WorkFlow:

1-empty dashboard is opened via custom directive.

2-widgets are added by providing click event to menu1 and menu2.which will broadcast event.and against that click event a widget is added to widgets array holding information about that widget.

Problem:

problem is routing basically.till now there is no routing involved.info is passed by broadcasting a click event.and by this i have achieved this coloured area.enter image description here

but the further navigation creates problem.when a state changes by clicking Menu1 or Menu2 it affects both the widgets and and ui-view portion in both widgets show same data.if Menu1 is clicked both widgets show data from Menu1 and vice versa.

Now.i have tried enough solutions but here i want an idea from ui router experts or custom directives' experts.cz i hv tried many possible ways and stuck here for almost a week.

Thanx very very much if anyone can help.

6
  • Just a thought, Menu1 and Menu2 changing together suggests a shared scope with their mutual parent. Have you checked scope inheritance? Commented Aug 2, 2015 at 16:00
  • menu1 and menu2 inherited from same parent which is main menu.but the child of these two menu1 and menu2 should be of different scope which couldn't be achieved. Commented Aug 3, 2015 at 6:26
  • Perhaps I don't have an accurate concept of the structure. But if the child for each, menu1 and menu2, was a custom directive then each could have an isolate scope and their navigation could be managed independently. Commented Aug 4, 2015 at 13:58
  • no child are not custom directives.they are simply partials loaded through state change. Commented Aug 4, 2015 at 14:09
  • Right, those views are scoped to the same controller. I don't use ui.router, but still wondering if the $state template could point to a directive with its own controller allowing you to have different data for each 'view'. I'm thinking about something like this stackoverflow.com/questions/22790209/… Commented Aug 5, 2015 at 15:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.