I'm new in JS and Angular. I try to make ng-show and ng-hide for my background and text. The problem is with my text: I can hide it smoothly, but when it's shown - I get all text first and just then I get my backround. How can I fix it?
JS:
var app = angular.module('myApp', ['ngAnimate']);
CSS:
div {
overflow: visible;
transition: all linear 0.5s;
background-color: lightblue;
height: 100px;
}
.ng-hide {
overflow: hidden;
height: 0;
opacity: 0;
}
HTML:
<input type="checkbox" ng-model="myCheck"/>
<div ng-show="myCheck">
Many text here<br/>
Many text here<br/>
Many text here<br/>
Many text here<br/>
Many text here<br/>
Many text here<br/>
</div>
You can specify a class for your div and use ng-hide transitions to control the animation.
Here is a simple demo: