...

/

Introduction to Angular Animations

Introduction to Angular Animations

An introduction to Angular animations, how they work, and how to use them in your project.

Angular animations are based on CSS web transition functionality, which means that anything that can be styled or transformed through CSS can be animated the same way using Angular animations, with the added advantage of giving the developer more control in orchestrating it. This provides us with animations that have CSS-like performance along with the flexibility of JavaScript out of the box without additional dependencies.

Press + to interact

How to use

To use @angular/animations in our application, we’ll have to do the following:

  1. Verify that the @angular/animations package is installed and listed as a dependency in our package.json. If not, add it by running npm install --save @angular/animations
  2. Import BrowserAnimationsModule and add it to the module’s imports array (line 7):
Press + to interact
// app.module.ts
import { NgModule } from "@angular/core";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
@NgModule({
imports: [BrowserAnimationsModule],
})
export class AppModule {}

Angular also comes with NoopAnimationsModule, which we can use to disable all animations ...

Access this course and 1200+ top-rated courses and projects.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy