Performance: BrowserAnimationsModule setup
MEDIUM IMPACT
This affects the page's animation rendering performance and initial load time by enabling Angular's animation system.
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; @NgModule({ imports: [BrowserModule, BrowserAnimationsModule], bootstrap: [AppComponent] }) export class AppModule {}
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; @NgModule({ imports: [BrowserModule], bootstrap: [AppComponent] }) export class AppModule {}
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No BrowserAnimationsModule with animations | Minimal | N/A | High due to fallback jank | [X] Bad |
| BrowserAnimationsModule imported when needed | Minimal | Minimal | Optimized paint and composite | [OK] Good |
| BrowserAnimationsModule imported unnecessarily | Minimal | Minimal | Unneeded paint/composite overhead | [!] OK |
| NoopAnimationsModule instead of BrowserAnimationsModule | Minimal | Minimal | No animation paint/composite cost | [OK] Good |