I am trying to implement a search feature with a Google map in my Ionic/Angular project.
However, I encountered the following error:
Runtime Error No provider for MapsAPILoader! Stack Error: No provider for MapsAPILoader! at injectionError ...
In the app.module file, I have the following code:
import {AgmCoreModule} from '@agm/core'; import {GoogleMapsAPIWrapper} from "angular2-google-maps/core/services/google-maps-api-wrapper"; imports: [ AgmCoreModule.forRoot({ apiKey: '*******', libraries: ["places"] }) ]
And in the Component Page:
import {MapsAPILoader} from 'angular2-google-maps/core'; constructor(private mapsAPILoader:MapsAPILoader) { ... }
The HTML page includes the following code snippets:
<div class="form-group"> <input placeholder="search for location" autocorrect="off" autocapitalize="off" spellcheck="off" type="text" class="form-control" #search [formControl]="searchControl"> </div> <agm-map [latitude]="latitude" [longitude]="longitude" [scrollwheel]="false" [zoom]="zoom"> <agm-marker [latitude]="latitude" [longitude]="longitude"></agm-marker> </agm-map>
I am currently stuck on where to find the Provider or where I need to place it. Any help would be greatly appreciated.