I wish to rotate an icon which is part of an accordion I have written, when a $scope
variable in my controller matches the $index
of a ng-repeat
I apply a class using ng-class
to a span I have to rotate it 180 degrees. All works however once the animation of the class 'u-r-180
' is complete the span returns to its original position! I don't want this to happen until we remove the 'u-r-180
' class when the $scope
variable 'selectedType
' has a new value (or has changed).
Here is my HTML... nothing to difficult...
<span class="icon-ic_list_arrow_down u-rotate" data-ng-class="{'u-r-180': selectedType === $index}"></span>
'icon-ic_list_arrow_down'
is part of a icon font I have in my app and is a arrow pointing downwards.
Here are my CSS classes...
.u-rotate {
transition: all 0.75s;
transform: rotate(0deg);
}
.u-r-180 {
transform: rotate(180deg) !important;
}
How do I make the span remain in the animated position (rotated 180 degrees) until I remove the class 'u-r-180
'?
Here is a very crude JSBIN... notice how the "V" rotates but then returns back to the original positon... https://jsbin.com/qevewe/edit?html,css,js,output