My Web page has the following tag:
<div data-ng-model="modal.data.message"></div>
Is there a simple way using that I can make a message "autosaving" fade into view in the <div>
and then fade out a couple of seconds after the function returns.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With