I have used angular material version: 5.2.1
And wanted to know how to disable their animations, especially the matDialog.
I have tried @.disabled but no luck.
You can use NoopAnimationsModule
by angular material
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
@NgModule({
...
imports: [NoopAnimationsModule],
...
})
export class PizzaPartyAppModule { }
Or if you want to remove transition on some specific components you can do it via CSS like this
.mat-dialog{ transition: none; }
The approved answer does not work and is not consistent with Angular docs, at least since Angular 6. To disable animations in Angular 6 to 13, from the official doc, use:
// In app.component.ts
import { Component, HostBinding } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
@HostBinding('@.disabled')
public animationsDisabled = true; // Set to true to disable animations
}
This is useful for end-to-end (E2E) testing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With