Following code is not working. It is supposed to show error or warning alert. Am I doing it correct?
<div ng-controller="HeaderController">
<div ng-class='{alert-danger:show, warning:isWarning}' class="alert" ng-show="show">{{messageText}}</div>
<button ng-click='showError()'>Simulate Error</button>
<button ng-click='showWarning()'>Simulate Warning</button>
</div>
</div>
and
<script>
var HeaderController = function ($scope) {
$scope.isError = false;
$scope.isWarning = false;
$scope.show = false;
$scope.showError = function () {
$scope.messageText = 'This is an error!';
$scope.isError = true;
$scope.isWarning = false;
$scope.show = true;
};
}
</script>