Ionic 4 - Dynamically add buttons in Action Sheet

Hi All, in Ionic 4 has anyone figured out how to dynamically add buttons in action sheets controllers?
In Ionic 3, I would do the following:

let actionSheet = this.actionSheetCtrl.create({
      title: 'Row Actions'});
     
      if (this.hasDeletePermissions) {
        actionSheet.addButton({text:'Delete Row', role: 'destructive', icon:'trash',handler: () =>{
          this.deleteRow();
        }});
      }

      actionSheet.addButton({text:'Add Row', role: 'destructive',handler: () =>{
        console.log('Do Something');
      }});
      actionSheet.addButton({text:'Cancel', role: 'cancel', icon:'close',handler: () =>{        
      }});
    
    actionSheet.present();

Is something similar to the above possible Ionic 4? If so I would really appreciate if someone could show me how. Many thanks in advance.

All good, Dynamic Buttons the solution in this works.

1 Like