Thursday, March 30, 2017

angularjs - How can I fade in and then fade out text inside a
- Stack Overflow

angularjs - How can I fade in and then fade out text inside a <div> - Stack Overflow



Add the ngShow directive to your div:
<div ng-model="message" ng-show="showMessage" class="message fadein fadeout">{{message}}</div>
When saving begins set showMessage = true and the message you want to display. When saving is done set showMessage = false. To show the message a while longer after the saving is done you can use $timeout:
// Loadind done here - Show message for 3 more seconds.
$timeout(function() {
    $scope.showMessage = false;
}, 3000);
The animation part depends on what version of AngularJS you are using.
Here is an example using 1.2: http://plnkr.co/edit/jBukeP?p=preview

No comments: