Hi, I am getting an error which seems to indicate that I am not catching a promise but I verified that all places I use this provider function there is a catch.
export class Location {
constructor(public latitude?:number,
public longitude?:number) {
}
}
@Injectable()
export class PhoneLocation {
getLocation() {
return new Promise((resolve, reject)=> {
Geolocation.getCurrentPosition({timeout: 20000, enableHighAccuracy: false})
.then((position) => {
resolve(new Location(position.coords.latitude, position.coords.longitude));
return;
})
.catch(
(err) => {
console.error('Could not read current location');
reject(err);
});
});
}
Error-
Error: Uncaught (in promise): [object PositionError] Geolocation
Configuration-
“dependencies”: {
"@angular/common": “2.1.1”,
"@angular/compiler": “2.1.1”,
"@angular/compiler-cli": “2.1.1”,
"@angular/core": “2.1.1”,
"@angular/forms": “2.1.1”,
"@angular/http": “2.1.1”,
"@angular/platform-browser": “2.1.1”,
"@angular/platform-browser-dynamic": “2.1.1”,
"@angular/platform-server": “2.1.1”,
"@ionic/storage": “1.1.6”,
“angular2-google-maps”: “^0.16.0”,
“ionic-angular”: “2.0.0-rc.3”,
“ionic-native”: “2.2.6”,
“ionicons”: “^3.0.0”,
“rxjs”: “5.0.0-beta.12”,
“zone.js”: "0.6.
Any ideas?