I recently got started with ng2. So I created a project using angular-cli, then I realized I need some third party modules. Such as Google maps api, lodash, jquery...etc. I know the basics of Typescript, but how do I use these modules in an Angular2 app? Also, I want to use just the library, for example Google maps api, not any existing ng2 module/component someone else made ontop of the Google maps api - For the sake of learning.
Previously, with just JS I would include the js file and reference the api documentation to know which methods to reference and build my app. Now with Angular2, what steps should I take to do the same?
From my research it looks like I first install the type script files needed.
so for Google maps I did npm install --save @types/google-maps.
Now, do I need to import this module into my angular app by including it in app.module.ts? In the imports array? Or is it now globally available?
One source mentioned installing it with npm and in my angular-cli.json including a reference to that library in the scripts array. like so:
"scripts": ['./node_modules/googlemaps/googemaps.min.js'],
Which method to use in installing the google maps api? I would think Typescript might be the way to go since the rest of the Angular app is going to be written in Typescript.
Now in my app.component.ts, I want to create a simple map using the typescript I installed. How would I do so? The google maps api says to create a new instance of the map like so.
var map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
scrollwheel: false,
zoom: 8
});
How would I do that with the typescript version of Googlemaps I just installed?
Would a typescript version of Googlemaps have all the same methods as the original API? Do typescripts of popular JS libraries have a documentation site I can reference?