maps.ts 1.35 KB
Newer Older
Manideep2897's avatar
Manideep2897 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams ,Platform} from 'ionic-angular';
import { AgmCoreModule } from '@agm/core';
import { Geolocation } from '@ionic-native/geolocation';

/**
 * Generated class for the MapsPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-maps',
  templateUrl: 'maps.html',
})
export class MapsPage {
  coords:any;
  location:any;
  firebase:any;
  constructor(public navCtrl: NavController, private geolocation: Geolocation,public navParams: NavParams,public platform:Platform) {
  }
   options={
     colorl:'#ASDF96',
     fontfamilyl:'',
     fontsizel:'14px',
     fontweightl:'bold',
     textl:'B',
    }
  

        
  mapUser(): void
  {
    this.platform.ready().then(()=>{
      let options={timeout:3000,enableHighAccuracy:true,maximumAge:0}
  this.geolocation.getCurrentPosition(options).then((location) => {
    console.log('Fetched the location successfully',location);
    this.location=location;
  }).catch((error) => {
    console.log('Error getting location', error);
  });
  });
  //let latitude : number=this.location.coords.latitude,
  //longitude : number=this.location.coords.longitude;
    }

  ionViewDidLoad() {
    console.log('ionViewDidLoad MapsPage');
  }

}