What are the steps to use animation module?
You need to follow below steps to implement animation in your angular project,
-
Enabling the animations module: Import BrowserAnimationsModule to add animation capabilities into your Angular root application module(for example, src/app/app.module.ts).
import { NgModule } from '@angular/core';import { BrowserModule } from '@angular/platform-browser';import { BrowserAnimationsModule } from '@angular/platform-browser/animations';@NgModule({imports: [BrowserModule, BrowserAnimationsModule],declarations: [],bootstrap: [],})export class AppModule {} -
Importing animation functions into component files: Import required animation functions from @angular/animations in component files(for example, src/app/app.component.ts).
import {trigger,state,style,animate,transition,// ...} from '@angular/animations'; -
Adding the animation metadata property: add a metadata property called animations: within the @Component() decorator in component files(for example, src/app/app.component.ts)
@Component({selector: 'app-root',templateUrl: 'app.component.html',styleUrls: ['app.component.css'],animations: [// animation triggers go here]})
October 31, 2022
1693
Read more
What is Angular Framework?
November 04, 2022
AngularWhat is a Angular module?
November 03, 2022
AngularWhat is State function?
October 30, 2022
Angular