This directory contains a simple Angular app that helps users locate a college in the US or Canada on a map, with place info such as ratings, photos, and reviews displayed on the side.
The sample app demonstrates usage of Web Components from both the Maps JS SDK and the Extended Component Library.
To view the app from a local dev server, first clone this library from GitHub, then run the following command from the repository's root directory:
MAPS_API_KEY="[REPLACE_WITH_YOUR_API_KEY]" npm run example:angular_sample_app
Note that this command will build the library locally to incorporate its latest changes, including those not yet released on NPM.
This project was generated with Angular CLI version 16.0.2.
Then, Google Maps features were added by:
- Installed the Extended Component Library via
npm i @googlemaps/extended-component-library
. - (TypeScript only) Installed the Google Maps typings with
npm i --save-dev @types/google.maps
, then openedtsconfig.app.json
and added"google.maps"
tocompilerOptions.types
. - (TypeScript only) Updated
tsconfig.json
withmoduleResolution: "Node16"
. - (TypeScript only) Updated
package.json
withtype: "module"
. - Added
CUSTOM_ELEMENTS_SCHEMA
to the schemas definedapp.module.ts
, telling Angular to be aware that Web Components are being used. - Imported Extended Component Library components at the top of
app.component.ts
. - Used Extended Component Library components, as HTML, in
app.component.html
.