crunch
crunch

Reputation: 375

latest angular with angular-animate

I'm rebuilding an application from the ground up that started as a jquery/bootstrap/kendo ui mess, but will be an angular(2/4)/kendo app going forward.

I was using jQuery slideUp/slideDown:

$('#id').slideUp('slow');
$('#id').slideDown('slow'); 

to show and hide div contents on an as-needed basis. I found angular-animate, which seems like it's a good fit, but I'm thinking angular-animate is for Angular 1.x? To add ngAnimate as a dependency, one writes:

angular.module('myApp', [require('angular-animate')]);

Can this be used in the latest angular, or is there a workaround?

Thank you!

Upvotes: 0

Views: 90

Answers (1)

Fahad Nisar
Fahad Nisar

Reputation: 1733

Its animate in Latest Angular.

npm i @angular/animations

Enable animation in main module like this:

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

Include animation like this:

import {
  trigger,
  state,
  style,
  animate,
  transition
} from '@angular/animations';

Here is the link which has code samples as well.

https://angular.io/guide/animations

Since you are coming from Angular 1. This will be a gud starting point:

http://developer.telerik.com/topics/web-development/nganimate-angular-2-animate/

Hope this helps.

Upvotes: 2

Related Questions