Reputation: 28368
I'm wondering how you import components hosted somewhere else, like a CDN.
If I got a link to someone's CDN for example: <script src="a-cdn-link.js"></script>
where a component named MyComponent
resides, in my own component file, what would I use as the import path?
I know that you can use the framework itself if included via a CDN but I don't understand how they make it so that you fetch from the correct path. I haven't tried using the CDN to import angular2 so I'm not quite sure exactly how it works.
Would you have to declare a path via SystemJS or another similar service?
Could do with some enlightment on the matter.
Upvotes: 2
Views: 2063
Reputation: 202346
In fact, you can include JS files like this if they use System.register('module-name', ...
to register explicitly a named module. JS files like that are generally generated from TypeScript ones leveraging the outFile
option of the TypeScript compiler.
If your JS files correspond to anonymous System modules or CommonJS / AMD ones, you need to configure them within the SystemJS configuration.
The following question could give some additional hints:
Upvotes: 1