Hey there! My first post in this forum!

I'm new to angular and I'm trying to animate some divs (slide up and slide 
down).

I have this code

http://plnkr.co/edit/xWB0sKAiEpXfYJzadHrh?p=preview

As you can see it works, but I think it's pretty ugly. 

I had to save the size of each div with content in a key-value array (where 
the key is the div's ID), 
otherwise if I don't save the size for each div and pass directly the size 
of the element where the animation is happening
it would change the size of all the other divs and it wouldn't work anymore 
as it would.

What I would like to know if it is possible to make it easier. I'm thinking 
of something like this

1.
angular.animation('.collapse1, .collapse2, .collapse3, .collapseN', ...)

2. 
angular.animation(['.collapse1', '.collapse2', '.collapaseN'.], ...)

This way the animation I have in the javascript file will be simplier and 
the changes I could make to an element won't affect the other ones and I 
won't need all that logic you can see (or maybe a little).

So far I have only one class that contains the animation and I think of 
(which is even ugliear than my code) 

- Remove the logic from the javascript, just keep the animation part
- Assign a different class to each div
- Copy & paste the 'angular.animation' for each class

Pretty ugly solution. I didn't even try it, but it might work.


The divs are hardcoded and I can't assign a specific size for each hidden 
div because the content is being loaded from a json file and its size varies
for each element (hardcoded container, dynamic content).


I googled for something like this and I found nothing. I'm using Angular 
1.4+ and ui.bootstrap it's not working yet with this version so as part of 
my learning I tried to make it by myself.

Let's say this doesn't exist in Angular so far, is ther anyway I could 
suggest to this be added in the future? Or am I asking for too much?

If I wasn't clear just tell me and I'll give you more details

PS : Sorry for my english

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to