$mdDialog confirm rearrange cancel-ok to ok-cancel

2.7k Views Asked by At

In our web app I use Angular-Materials $mdDialog with the confirm-object. Is it possible to change the order of the buttons from cancel-ok to ok-cancel? And to set the initial focus to the cancel button? Maybe via CSS or a template?

The code looks like that:

var confirm = this.$mdDialog.confirm()
  .parent(angular.element(document.body))
  .title('Löschen')
  .content('Möchten Sie wirklich löschen?')
  .ariaLabel('Löschen')
  .ok('Ja')
  .cancel('Nein')
  .targetEvent(event);

this.$mdDialog.show(confirm)
  .then(() => {
     // do something
  });

enter image description here

1

There are 1 best solutions below

2
On

This might work:

md-dialog md-dialog-actions {
    display: block;
}

md-dialog md-dialog-actions button {
    float: right;
}