1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

ReferenceError: "google is not defined"

Discussão em 'Angular' iniciado por Rafff, Junho 10, 2025.

  1. Rafff

    Rafff Guest

    I use Angular Google Maps to display a google map in my angular 7 app.

    I needed google maps typings to do something like this:

    allowedBounds = new google.maps.LatLngBounds(
    new google.maps.LatLng(51.130739, -0.868052), // SW
    new google.maps.LatLng(51.891257, 0.559417) // NE
    );


    So I did npm install --save-dev @typings/googlemaps

    I tried many different things to try to resolve the error but none worked for me.

    import {} from 'googlemaps'
    declare const google: any;


    In tsconfig.json I have "typeRoots": ["node_modules/@types"] and in tsconfig.app.json "types": ["googlemaps"]

    The app compiles without errors but in chrome console I get an error:

    ERROR ReferenceError: "google is not defined"

    Continue reading...

Compartilhe esta Página