I have this constructor function buy I need to take out the value of lat1,lat2,lon1,lon2 from the constructor to use the constant out off the constructor
export class MapasPage {
map: any;
markers:any;
//datos
contacts: ContactList[];
Latitud:any;
Longitud:any;
Lat1:any;
Lon1:any;
Lat2:any;
Lon2:any;
constructor(public navCtrl: NavController, public geolocation: Geolocation, public platform:Platform,private contactProvider: ContactProvider) {
///datos
this.contactProvider.getAll()
.then((result) => {
this.contacts = result;
let answer = this.contacts.map(x=> {
let {name2, name3} = x.contact;
let obj = {name2,name3}
return obj
})
this.Latitud= answer.map(({ name2}) => name2);
this.Longitud= answer.map(({ name3}) => name3);
// console.log(answer)
this.Lat1=this.Latitud[0];
this.Lat2=this.Latitud[1];
this.Lon1=this.Longitud[0];
this.Lon2=this.Longitud[1];
// console.log(this.Lat1)
})
}