hi, im new here, i was follow tutorials, but i have 2 problems,
i dont have error message on terminal about this. (the next message show in Firefox , chrome and ie)
1: Runtime Error
Error in ./HomePage class HomePage - caused by: Cannot read property ‘getCurrentPosition’ of undefined
Code:
/ import { Component } from ‘@angular/core’;
/ import { Geolocation } from ‘@ionic-native/geolocation’;
/ import { NavController } from ‘ionic-angular’;
/ @Component({
/ selector: ‘page-home’,
/ templateUrl: ‘home.html’
/ })
/ export class HomePage {
/ geolocation: Geolocation;
/ coords : any;
/ accuracy: any;
/ error: any;
/ constructor(public navCtrl: NavController) {}
/ watch() {
/ this.geolocation.getCurrentPosition().then((resp)=>{
/ this.coords = resp.coords.latitude + ' ' + resp.coords.longitude;
/ this.accuracy.coords.accuracy + 'meters';
/ }).catch((error) =>{
/ this.error='Error al obtener la ubicacion.';
/ })
/ }
/ }
- dont show nothing, i cant see anything un my explorer, why?
if i remove tag, and then works…
code:
/
/
/ <button ion-button (click)=“watch()”>Obtener mi posicion
/
Position: {{ coords }}
/
Accuracity: {{ accuracity }}
/ <p *ngIf=“error”> {{ error }}
/
/
— help, please, i want to keep going Through the tutorials