ionic geolocation plugin error: "No provider for Geolocation"
You need to import the Geolocation class and add it to your list of providers in the app.module.ts file
import { Geolocation } from '@ionic-native/geolocation';
providers: [
Geolocation
]
You need to add the provider to the NgModule, i.e module.ts under providers,
providers: [
Geolocation
]
For Ionic 4 you add to app.module.ts
top:
import { Geolocation } from '@ionic-native/geolocation/ngx';
And on the bottom, inside of the Providers
array, add Geolocation
:
providers: [
Geolocation,
...
]