What's the difference between BrowserAnimationsModule and NoopAnimationsModule?

前端 未结 2 1401
予麋鹿
予麋鹿 2020-12-05 12:58

With the new Angular-Material release, you need to add a module for Angular-Animations. You can choose between two BrowserAnimationsModule and NoopAnimationsModule. The offi

2条回答
  •  天命终不由人
    2020-12-05 13:18

    As the name noop ("no operation") says, that module doesn't do anything. It is a utility module that mocks the real animation module but doesn't actually animate.

    This can be handy on platforms where animation would be too slow, or for testing (unit, integration, e2e with Cypress, Protractor, ...) , if animation isn't involved in what you actually want to test.

    @NgModule({
      imports: [
        BrowserModule,
        environment.production ? BrowserAnimationsModule : NoopAnimationsModule,
        ...
       ]
       ...
    }
    export class AppModule {}
    

提交回复
热议问题