javascriptangularjsmddialog

When opening mdDialog, it scrolls down the dialog instead of showing the part on top


You can observe the behavior in this link. When you click on the button "Comment" it opens the modal, shows the header / title and then scroll down inside the modal.

  <md-dialog-actions layout="row">
    <md-button class="md-raised md-primary" ng-click="cancel()">Cancel</md-button>
  </md-dialog-actions>

I think it is the md-dialog-actions tag, because when I comment it, the modal doesn't scrolls down, but I have no idea how to fix it.


Solution

  • In your controller you should include the "focuOnOpen: false" in your showDialog function, just like the following:

    showDialogDonation() {
        this.dialog = this.$mdDialog.show({
          focusOnOpen: false,
        });
    }