- read

How use angular/google-maps first look

Yurii K 22

To use google map we need to import the Maps API. For that, we must add a script in index.html with the API key.

The next step is to install google maps in your project.

npm install @angular/google-maps

After that, we need to add GoogleMapsModule in our module

All preparation is done. Now we can write our map component. To use google maps we just need to use the selector <google-map> in the HTML file. To set position we need to use the center attribute with latitude-longitude coordinate. For markers, we need to add a selector <map-marker>.

As a result, we have a google map with a marker.

If you need to take a close look at the project here is the link.