how to set value dynamically default value in ion-select-option
06:47 17 Mar 2020

I'm using Ionic 4.
I want to show a default value in ion-select-option.
Option's values come from the server.
API works all values show but on click of ion-select.
But I want to show the default value.

I have already initialized userData.business_type in the constructor.
I have updated my question you can see that.
when my page load no value shown in ion-select only drop-down button show but when I click on the drop-down button then value shown.
But I want to show the first value by default when page visible to the user.

Response

 {"success":1,"service_details":[{"id":"1","name":"Job\/Service","status":"1"},
{"id":"2","name":"Student","status":"1"},{"id":"3","name":"House Wife","status":"1"},{"id":"4","name":"Business","status":"1"}]}

register.ts

 userData = { "fname": "", "lname": "", "contact_no": "", "email_id": "", "password": "", 
 "business_type": "", "organization_name": "", "designation": "", };

constructor () { 
     this.userData.business_type = "1";
 }

getAllService(){
    let loading = this.loadingCtrl.create({
      spinner: 'circles',
      message: 'Please wait...'
    }).then(loading => loading.present());

    this.authService.getData("get_all_service_type.php").then((result) => {
      this.items = result;
        this.success = this.items.success;
        console.log(this.success);

        if (this.success == 1) {
          this.loadingCtrl.dismiss();
          this.serviceData = this.items.service_details;
          console.log(this.serviceData);
        } else {
          this.message = this.items.message;
          this.loadingCtrl.dismiss();
        }

    }, (err) => {
       this.loadingCtrl.dismiss();
      console.log("Error", err);
    });
  } 

register.html

 
     Occupation 
     
         
{{item.name}}

OR


   Occupation
   
        {{item.name}}
   

android ionic-framework ionic4 default-value ion-select