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.
How to use
To use @angular/animations
in our application, we’ll have to do the following:
- Verify that the
@angular/animations
package is installed and listed as a dependency in ourpackage.json
. If not, add it by runningnpm install --save @angular/animations
- Import
BrowserAnimationsModule
and add it to the module’s imports array (line 7):
// app.module.tsimport { 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 ...
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy