What I want is to show a DIV when I click a button and hide it after 2s.
<div ng-show="alertMsg.show">{{alertMsg.text}}</div>
After triggering the click event, the DIV shows correctly, but cannot hide. It seems that the value of "alertMsg.show" has been changed to FALSE correctly after 2s, but the DIV still there in the view.
Click Event:
$scope.$apply(function(){
$scope.alertMsg.show = true;
});
$timeout(function () {
$scope.alertMsg.show = false;
}, 2000);
I want to know how to hide the DIV via $timeout