I am trying to figure out how to correctly import an external library into my Angular2 projects. As you can see, after reading the other answers on this question, there is a bit of confusion about this, and even the Angular2 documentation has no information about this. In addition, any search on Google leads to old results related to the alpha or beta version of Angular2.
I am trying to import Foundation and jQuery libraries. I need the first to use some Foundation code, and I need the second to make Foundation JJ code work (it uses jQuery) and even use it in my Typescript components.
As far as I know, since I have to use jQuery even in my Typescript code, I need to install a โprinted versionโ of jQuery.
So, I have two types for importing external libraries into Angular2 projects:
First way:
I can do this after this answer . That way I can use jQuery code in my Typescript components, and it has been working ever since I import the node library with the SystemJS module SystemJS , and since I set typings for jQuery ( typings install dt~jquery --save --global )
The second way:
I am adding <script src="node_modules/foundation-sites/dist/foundation.js"></script> to the index.html file. I do not need to include SystemJS and not a single typings .
But in this case, I need jQuery to run Foundation. Do I need to import jQuery again using the first method? I want to add <script src="node_modules/jquery/dist/jquery.js"></script> to the index file. In any case, I am experiencing some problems downloading the Foundation framework, as you can see here
So what happened to my import?
Generally speaking, how to import external libraries into Angular 2.0.0 projects?
In my case, how to import Foundation correctly to use its building blocks and how to import jQuery correctly to make Foundation work and get me to write jQuery code in Typescript components?
source share