Handsome Programmer
Handsome Programmer

Reputation: 53

Issue about my error stated in my ts file

I want user to click on this label here and they will be directed to Google Maps where it will state the address. I did have a onclick function on this label called 'startExternalMap()', but I got some errors I don't understand and I don't know how to solve it. Here is the error! All of the underline have the same error. How do I solve it?

This is my code for my html file here!

This is my code in my ts file for my onclick function.

@Component({
    selector: 'page-order',
    templateUrl: 'info.html'
})
export class OrderInfoPage {

    order: Order;
    moment;
    from: boolean = true;

    constructor(private alertCtrl: AlertController, private request: ApiRequest, private userData: UserData, public navCtrl: NavController, private params: NavParams, private drivers: DriverData, public plt: Platform, private user: User, private modalCtrl: ModalController, private viewCtrl: ViewController) {

        this.request.showLoading();

        this.order = this.params.get('order');
        this.moment = moment;

        this.plt.ready().then(()=>{
            let status = this.order.status_id;

        //if from is false updateStatus not working
            let id = ['102','301','311','321'];
            for(let i in id){
                if(status == id[i]){
                    this.from = false;
                }
            }
        });
        this.drivers.drivers_data.length>0 ? 0 : this.drivers.getDrivers();
    }

startExternalMap() {
    if (this.location.latitude){

    this.platform.ready().then(() => {

      Geolocation.getCurrentPosition().then((position) => {
        // android
        if (this.platform.is('android')) {
          window.open('geo://' + position.coords.latitude + ',' + position.coords.longitude + '?q=' + this.location.latitude + ',' + this.location.longitude + '(' + this.location.name + ')', '_system');
        };
      });
    });
    }; 
}

Upvotes: 0

Views: 33

Answers (1)

Shashan Sooriyahetti
Shashan Sooriyahetti

Reputation: 878

You have defined Platform in constructor as public plt: Platform. So you should call to this.plt not this.platform. Also there is no this.location so you should define it first. Solve these errors first and check it.

Upvotes: 1

Related Questions