<style>
.error{background-color:
red;}
.warning{background-color: yellow;}
</style>
<script>
app.controller("headerController",function($scope){
$scope.isError=false;
$scope.isWarning=false;
$scope.showError=function(){
$scope.messageText="this
is an
error";
$scope.isError=true;
$scope.isWarning=false;
}
$scope.showWarning=function(){
$scope.messageText="just
a
warning";
$scope.isError=false;
$scope.isWarning=true;
}
});
<script>
<body>
<div
ng-controller="headerController">
<div
ng-class=‘{error:isError,warning:isWarning}‘>{{messageText}}</div>
<button ng-click="showError()">error</button>
<button ng-click="showWarning()">warning</button>
</div>
</body>