Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 1.4 and using ngAnimate with JavaScript

I'm trying to setup a ngAnimate .animation() script with Angular 1.4 but I am struggling with the basics as this should display an alert but it does not :

.animation('.animated', function () {
     // should display an alert here...
     alert('hello ?');
})

I must be missing something but can't figure out what. Here is a jsfiddle.

Thanks a lot for your help.

like image 922
leonsaysHi Avatar asked Jul 31 '26 16:07

leonsaysHi


1 Answers

Animation is triggered using one of directives described here Docs. For example ngClass. Demo.

<div ng-app="MyApp">
    <div ng-controller="MyCtrl">
        <span ng-class="{animated: true}">Hello {{who}}.</span>
    </div>
</div>
like image 65
Yury Tarabanko Avatar answered Aug 02 '26 06:08

Yury Tarabanko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!