1

I'm trying to animate certain elements on my web-page, and am running into a problem with the ngAnimate module. I've set up some CSS classes for .ng-enter and .ng-enter-active:

/*Animations*/
.fade.ng-enter {
 -webkit-transition: 1s linear all;
  transition: 1s linear all;
  opacity: 0;
}
.fade.ng-enter-active {
 opacity: 1;
}
 <div class="container searchContent">
  <div class="panel fade" ng-repeat="object in objects">
   <h1>{{object.name}}</h1>
   {{object.description}}
  </div>
 </div>

But this doesn't work. It doesn't work if "fade" is an id either. But, animations still do work when I make it contingent on an HTML element:

/*Animations*/
div.ng-enter {
 -webkit-transition: 1s linear all;
  transition: 1s linear all;
  opacity: 0;
}
div.ng-enter-active {
 opacity: 1;
}

This makes all the divs fade in, but I want to be able to make only certain divs fade. All of the resources I've found online indicate that this is the proper way to do it, but it doesn't work for me, and I'm not getting any errors in the console.

Perhaps it has something to do with UI router or something else, but I'm truly stumped on why it would perform like this.

I'll also include any other code that I think would be relevant to this problem. Tell me if you want to see anything else. Thanks:

Original app configuration:

var app = angular.module("app", [
 'ngRoute',
 'ngAnimate',
 'ui.router',
 'homeController',
 'searchController',
 'apidpController',
 'nLogin',
 'nSignUp',
 'nLogo',
 'flButton',
 'nSearch',
 'userRequest'
]);

app.config(["$stateProvider", "$urlRouterProvider", "$locationProvider", function($stateProvider, $urlRouterProvider, $locationProvider) {
 $urlRouterProvider.otherwise("/home");

 $stateProvider.
  state('presentation', {
   templateUrl: './app/presentation/presentation.tpl.html',
   url: '/'
  }).
  state('presentation.home', {
   templateUrl: './app/home/home.tpl.html',
   controller: 'homeController',
   url: 'home'
  }).
  state('presentation.search', {
   templateUrl: './app/search/search.tpl.html',
   controller: 'searchController',
   url: 'search'
  }).
  state('api', {
   templateUrl: './app/apidp/apidp.tpl.html',
   controller: 'apidpController',
   url: 'api'
  });
}]);

I want the animations to be inside presentation.search

jaxoncreed
  • 1,069
  • 2
  • 13
  • 24

0 Answers0