I have no idea why I am getting these error. As far I have checked I don't think that the syntax are incorrect or something is missing. May be I am wrong. Please take a look at my code:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Geolocation } from '@ionic-native';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
coords:any;
accuracy:any;
error:any;
constructor(public navCtrl: NavController) {
}
watch(){
Geolocation.getCurrentPosition().then(resp) => {
this.coords= resp.coords.latitude+' '+resp.coords.longitude;
this.accuracy= resp.coords.accuracy+' '+'meters';
}).catch((error)=>{
this.error='Error getting location'+error;
})
}
}
//These are the error log in brief:
Typescript Error
';' expected.
Typescript Error
Declaration or statement expected.
Typescript Error
'try' expected.