You can host the script on any server in the world -- that much doesn't matter.
You will have to include the module as a dependency, otherwise how will Angular know about the directive when it encounters it in the DOM? On Sunday, May 11, 2014 9:20:45 PM UTC-4, Eugene Y.E wrote: > > Hey thanks for the reply! > > I have 2 follow uo question regarding your reply: > 1) I was wondering if there's any chance where the third party user have > no need to include my module as a dependency and my directive on their > server ? > For example, when we want to use Facebook's Social Widget, we just need to > include the Facebook js script and initialize it. > > 2) For 1. to work, will it work if all the files are on my server, but the > third party site simply includes the script on their site ? > For example: on a third party website: http://3rdparty.com , and on their > header they include: > <script src="//myangulardirective.js></script> > > And it will just work for the 3rd party site ? > > Best Regards > > > On Monday, May 12, 2014 8:53:15 AM UTC+8, umi wrote: >> >> 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<http://www.google.com/url?q=http%3A%2F%2Fngmodules.org&sa=D&sntz=1&usg=AFQjCNFTWDzfQKZR9eW4K0mLhYJUZuNyLA>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.
