Я установил родной для этого плагина cordova и ioni c https://ionicframework.com/docs/v3/native/geolocation/ Когда я добавляю его, мои списки импорта в app.module.ts загружаются на мои html страницы, но как только Когда я добавляю Geolocation в провайдеров, в браузере меня встречает пустой белый экран. В консоли это сообщение об ошибке: SCRIPT5002: SCRIPT5002: ожидаемая функция
это код для моего файла app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import{HttpClientModule} from "@angular/common/http"
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { Geolocation } from '@ionic-native/geolocation';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, HttpClientModule],
providers: [
StatusBar,
SplashScreen,
Geolocation, //as soon as geolocation is added too the providers im met with a blank screen
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}
это код для компонента, использующего геолокация.
import { Component, OnInit } from '@angular/core';
import { Geolocation } from '@ionic-native/geolocation';
@Component({
selector: 'app-gps',
templateUrl: './gps.page.html',
styleUrls: ['./gps.page.scss'],
})
export class GpsPage implements OnInit {
constructor(private geolocation :Geolocation) { }
ngOnInit() {
this.geolocation.getCurrentPosition().then((resp) => {
}).catch((error) => {
console.log('error getting location',error)
})
}
}