I'm working on Angular 2 and I'm trying to include inside a TypeScript (.ts file) a .js file. The JavaScript file I want to include is a simple google maps file, here it is:
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: { lat: -34.397, lng: 150.644 },
zoom: 8
});
}
</script>
I downloaded the google-maps.d.ts declaration file from here and I moved this file in the same project (and folder) of my .ts file.
So I have a folder with the .ts, .js and google-maps.d.ts inside.
My .ts for completeness looks like:
import {Component, Injector, OnInit} from "angular2/core";
/// <reference path="./google-maps.d.ts" />
@Component({
selector: 'my-map-selector',
template: `
<div id="map"></div> // google map will appear here
`,
})
export class mymapComponent {
}
Now, how do I import the .js file inside .ts?
I tried with /// <reference path="./google-maps.d.ts" /> but nothing happened (can't see the map)