Hi Sander

Thanks for your input! It sounds that with a service/directive pattern this 
should be possible. 

Yet a few questions remain:
How can the service talk to the directive? Say in a page controller we added a 
panel to the service. How can we update the content of the directive? In other 
words, how do we propagate the changes in the model to the directive?
Additionally, when we catch a close event of a panel in the directive, how 
would you propagate the changes to the service? 

Will work on this today, if I come up with a nice solution I will let you know 
:)

Thanks!
Ben


On 03.07.2014, at 05:50, Sander Elias <[email protected]> wrote:

> Hi Ben,
> 
> You need both, service(s) and at least 1 directive. The manipulation and de 
> management should be put in services. 
> the actual viewing of the data can be handled by the directive(s).
> However this leaves you with 1 problem, what if you are calling the service, 
> and the directive is not on the page yet?
> Actually there are at least 2 ways to handle this. 
> Is the simplest one. Throw an 'directive xxx not found' error and make it the 
> responsibility off the developer.
> Add it to the dom from your service. I know that this is a violation of the 
> best practices, but in this particular case
> its acceptable in my eyes. Just make sure you document this behaviour very 
> well, and you still might 
> throw a warning! I would just append the needed directive to the page body, 
> but it is you that makes this
> decision.
> Let me know if you find a 'better' way. Really!
> 
> Does this help you?
> Regards
> Sander
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "AngularJS" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/angular/tEXdzqUtR9Y/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to