How about creating a "mixin" service, and then injecting it into your 
directive factory functions?

Define a method on the service called something like "MakeVeggieDirective" 
which accepts an object.  The job of the method will be to attach the 
common properties and methods that your directive object will need, like 
template, restrict, etc.

Then, in each of your directive factory functions, pass your directive 
definition object (that the factory function will ultimately return) to 
MakeVeggieDirective.  This will prepare it with those common members.

Make sense?

On Thursday, May 15, 2014 7:36:37 AM UTC-4, breaddes wrote:
>
> I wonder how deal with repetitive patterns in angular. Here is an example: 
> http://plnkr.co/edit/o8ex2IwVieEb8MxEBP01
>
> In an OOP pattern I would have created a veg class that shares all common 
> attributes and methods.
>

-- 
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