Using library from npm package @google/maps for Ionic 2 project?


#1

Hi, this could be silly question from newcomer, but I wonder about can I use Node.js library with stack that Ionic 2 (Node package system with package.json , Angular 2, Cordova) provides. I found interesting for my project library from Google ( I need geocoding for some form validation).
For this moment I added this package to package.json with

npm install @google/maps --save
npm i

I created provider for client consuming, added

import {} from ‘@google/maps’;

and understood that I need some sort of typings for TS:) Is it really an option to use separate from Ionic and Angular libraries or am I wasting my time?

Update
Thanks to @Ivaro18 on SO, I managed how to add typings to my project:

npm install @types/google-maps --save

Now I can make something like this:

    import GoogleMapsLoader = require('google-maps');


    @Injectable()
    export class GoogleMapsClientProvider {
    
    
      constructor(public http: Http) {
        console.log('Hello GoogleMapsClientProvider Provider');
        GoogleMapsLoader.createLoader();
        };
    
    
    
    }

I found about this here but I’m not sure how to use this stuff,e.g.

  GoogleMapsLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm';
  GoogleMapsLoader.CLIENT = 'yourclientkey';

What is what? Someone tried this lib before? My mandatory task is to use geocoding for address validation.