I'm a beginner when it comes to JavaScript and Angular. I am attempting to use ng-show and ng-hide for my background and text elements. However, I am experiencing an issue with my text: It smoothly hides, but when it is shown again, the text appears before the background. How can I solve this problem?
JavaScript:
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">
Lots of text here<br/>
Lots of text here<br/>
Lots of text here<br/>
Lots of text here<br/>
Lots of text here<br/>
Lots of text here<br/>
</div>