how to send dynamic data in alertcontroller in ionic4

 public AppIds = [

    {Id: "5", AppName: "YouTube", AppPath: "com.google.android.youtube", IosAppPath: null},

    { Id: "5", AppName: "Netflix", AppPath: "com.google.android.youtube", IosAppPath: null }

]

  let input={data:[]};
    for (let i=0;i<this.AppIds.length;i++) {
      input.data.push({name:this.AppIds[i].AppName,type: 'radio',label:this.AppIds[i].AppName,value: this.AppIds[i]})
    }
    
      console.log(input);
      const alert = await this.alertController.create({
        header: 'Select Application',
        inputs: input.data,
        buttons: [
          {
            text: 'Cancel',
            role: 'cancel',
            cssClass: 'secondary',
            handler: () => {
              console.log('Confirm Cancel');
            }
          }, {
            text: 'Ok',
            handler: (data) => {
              console.log(data,"testdata");
            }
          }
        ]
      });
      await alert.present();
    
    

Comments

Popular posts from this blog

Your app currently targets API level 27 and must target at least API level 28 to ensure it is built on the latest APIs optimized for security and performance. Change your app's target API level to at least 28

ionic project creation

change root user in ubuntu