-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexemplo 4.7 – css-class-map.html
More file actions
37 lines (34 loc) · 858 Bytes
/
exemplo 4.7 – css-class-map.html
File metadata and controls
37 lines (34 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!doctype html>
<html ng-app="myApp">
<style type="text/css">
.error{
background-color: red;
}
.warning{
background-color: yellow;
}
</style>
<body>
<div ng-controller='ClassController'>
<div ng-class='{error: isError, warning: isWarning}'>Eu sou um texto!</div>
<button ng-click='showError()'>Simular Erro</button>
<button ng-click='showWarning()'>Simular Warning</button>
</div>
<script src="angular.min.js"></script>
<script type="text/javascript">
var app = angular.module('myApp',[]);
app.controller('ClassController',['$scope',function($scope){
$scope.isError=false;
$scope.isWarning =false;
$scope.showError =function(){
$scope.isError =true;
$scope.isWarning =false;
};
$scope.showWarning = function(){
$scope.isWarning = true;
$scope.isError = false;
};
}]);
</script>
</body>
</html>