AngularJS ngMouseover example with ngClass.
HTML
<div ng-app="myApp" ng-controller="MainCtrl">
<div ng-class="getClass()" ng-mouseover="toggle()">Mouseover me!</div>
</div>
CSS
.red {
background: red;
}
.blue {
color: white;
background: blue;
}
JavaScript
var app = angular.module('myApp', []);
app.controller('MainCtrl', function($scope) {
var showing = false;
$scope.getClass = function() {
if ( showing ) {
return 'red';
} else {
return 'blue'
}
};
$scope.toggle = function() {
showing = !showing;
};
});