Created
March 1, 2014 04:54
-
-
Save limichange/9285419 to your computer and use it in GitHub Desktop.
change css2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en" ng-app> | |
<head> | |
<meta charset="UTF-8"> | |
<title>test</title> | |
<style> | |
.error { | |
background-color: red; | |
} | |
.warning { | |
background-color: yellow; | |
} | |
</style> | |
</head> | |
<body> | |
<div ng-controller="HeaderController"> | |
<div ng-class='{error: isError, warning: isWarning}'>{{messageText}}</div> | |
<button ng-click='showError()'>Simulate Error</button> | |
<button ng-click='showWarning()'>Simulate Warning</button> | |
</div> | |
<script type="text/javascript" src="angular.min.js"></script> | |
<script type="text/javascript" src="main.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function HeaderController($scope) { | |
$scope.isError = false; | |
$scope.isWarning = false; | |
$scope.showWarning = function() { | |
$scope.isError = false; | |
$scope.isWarning = true; | |
$scope.messageText = 'this is a warning'; | |
} | |
$scope.showError = function() { | |
$scope.isError = true; | |
$scope.isWarning = false; | |
$scope.messageText = 'this is a error'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment