Yes you could reuse the directive. After all, we're able to reuse packages
like ui-bootstrap in our angular apps.
Create a module for your app and create your directives in it:
angular.module('myCompany.social')
.directive('socialMedia', function () { ... });
A third party user could include your module as a dependency in their app
and have access to the directives, services, filters etc... you provide.
You could package all your stuff in a directory with any additional assets
required i.e. templates, css etc..
Check ngmodules.org for examples.
On Sunday, May 11, 2014 9:30:19 AM UTC-4, Eugene Y.E wrote:
>
> Hi good day,
>
> I am really excited about AngularJS and the concept on directives seems
> really cool as it can be readily be re-used on my angularapp.
>
> I was wondering if I can reuse a directive on a third party site ?
>
> For example, I am the owner of website A. and I have created a directive,
> take for example a social share directive.
>
> Is it possible for other websites (besides website A) to use my directive
> by simply embedding <social-share></social-share> in their webpage ? I'm
> assuming that AngularJS is installed on their webpages as well.
>
> Can this be done ( or technically possible ) ? Am I missing anything or is
> there anything that I should be looking out for ?
>
> Thanks !
>
--
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.