How to install Typescript typings for google maps

前端 未结 12 1040
春和景丽
春和景丽 2020-11-28 04:07

How can it be done - I\'ve tried combinations of

typings install [googlemaps | google.maps] [--ambient] --save

and end up with variations o

12条回答
  •  有刺的猬
    2020-11-28 04:17

    For users of Angular9+ I would STRONGLY recommend using their official component

    Step 1: Installation:

    npm install --save-dev @angular/google-maps

    Step 2: Registration

    @NgModule({
      imports: [
        GoogleMapsModule
      ]
    })
    export class AppModule { }
    

    Step 3: Implementation

    
    
    center = new google.maps.LatLng(-30.5595, 22.9375);
    options: google.maps.MapOptions = {
      mapTypeId: 'hybrid',
    };
    

    See https://medium.com/angular-in-depth/google-maps-is-now-an-angular-component-821ec61d2a0 for a more detailed guide

提交回复
热议问题