Search code examples
angularangular-material2

How to implement MAT_DIALOG_DEFAULT_OPTIONS?


On a project we multiple Dialog's. Now, I want to set samen global variables to the DialogOption.

I found: https://material.angular.io/components/dialog/overview and this code:

@NgModule({
  providers: [
    {provide: MAT_DIALOG_DEFAULT_OPTIONS, useValue: {hasBackdrop: false}}
  ]
})

I applied these code with some other, but it doesn't work. The settings doesn't applied at all.

Does anybody get these setting worked?


Solution

  • That works... Go here and add these to verify it.

    import {MAT_DIALOG_DEFAULT_OPTIONS} from '@angular/material';
    
    ....
    
    providers: [
      {provide: MAT_DIALOG_DEFAULT_OPTIONS, useValue: {hasBackdrop: false}}
    ]