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.

N.A
  • 855
  • 4
  • 13
  • 34
  • Just a thought, Menu1 and Menu2 changing together suggests a shared scope with their mutual parent. Have you checked scope inheritance? – ElliotPsyIT Aug 02 '15 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. – N.A Aug 03 '15 at 06: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. – ElliotPsyIT Aug 04 '15 at 13:58
  • no child are not custom directives.they are simply partials loaded through state change. – N.A Aug 04 '15 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 http://stackoverflow.com/questions/22790209/angular-ui-router-ui-views-vs-directives – ElliotPsyIT Aug 05 '15 at 15:08
  • $state isn't pointing to a directive directly but by state->template.e.g;$state.go("home");$stateProvider.state("home",{url:"some-url-here",template:""});this navigation isn't as tough problem is navigation between states inside . – N.A Aug 05 '15 at 16:09

0 Answers0