Reputation: 2965
I have a system in place that retrieves dynamically retrieves stored messages from the server, the view for it is:
<div id= "messages" data-ng-controller="MessageController">
<div class="message" data-ng-repeat="message in messages | orderBy:'timestamp':true" data-ng-animate="'animate-message'" >
<div class="user">
{{ message.user.username }}
</div>
<div class="title">
{{ message.title }}
</div>
<div class="content" data-ng-bind-html-unsafe="message.content">
{{ message.content }}
</div>
</div>
</div>
I then have in my CSS file:
.animate-message-enter {
transition: 1s linear all;
-moz-transition: 1s linear all;
-webkit-transition: 1s linear all;
-o-transition: 1s linear all;
-ms-transition: 1s linear all;
opacity:0;
position:relative;
left:-100%;
}
.animate-message-enter.animate-message-enter-active {
opacity:1;
left:0%;
}
(this is just an extreme example transition so I can see the transition working)
However, upon a new object being entered into the array via $scope.messages.push(response);
the new message simply pops onto the page and no animations take place, does anyone know what I've messed up?
Thanks :)
Upvotes: 0
Views: 811
Reputation: 1374
Tried to copy paste your code into plnkr and it works fine. Do you have more code?
http://plnkr.co/edit/gi6h3adNMfoXkUdiN4lY
The only thing I added was a simple addMessage function to test the transition.
<button ng-click="addMessage()">Add Message</button>
Upvotes: 1