Monday, 14 May 2018

028 AngularJS Animation

AngularJS Animation
Animation is a process to achieve some visual effect on the view.
To achieve Animation , you have to do

1) Add “angular-animate.js”  to your application.


2) You have to add “ngAnimate” to your application.


Example :

<!DOCTYPE html>
<html>
              <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
              <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular-animate.js"></script>

<style>
div {
         transition: all linear 0.5s;
         background-color : Green;
         height: 100px;
         width: 100px;
}

.ng-hide {
            height: 0;
            width: 0;
            background-color: transparent;
           top:-200px;
           left: 200px;
}
</style>
<script>
          var app = angular.module('myApp', ['ngAnimate']);
</script>

<body ng-app="myApp">

<h1>Check / Uncheck to show hide div : <input type="checkbox" ng-model="mldShowHide"></h1>

<div ng-hide="mldShowHide">
</div>


</body>
</html>


Output

ngAnimate does not do animation , ngAnimate directive are added to notice event related to animation.The folling is the directive commonly used during animation programmig.

  1. ng-show
  2. ng-hide
  3. ng-class
  4. ng-view
  5. ng-include
  6. ng-repeat
  7. ng-if
  8. ng-switch
  9. ng-animate
  10. ng-hide-animate
  11. ng-hide-add
  12. ng-hide-remove
  13. ng-hide-add-active
  14. ng-hide-remove-active





No comments:

Post a Comment

বাঙালির বেড়ানো সেরা চারটি ঠিকানা

  বাঙালি মানে ঘোড়া পাগল | দু একদিন ছুটি পেলো মানে বাঙালি চলল ঘুরতে | সে সমুদ্রই হোক , পাহাড়ি হোক বা নদী হোক। বাঙালির ...