toggle class angular

by karin

HTML

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<div data-ng-app="testModule" data-ng-controller="testController">
<button ng-class="expand ? 'da-shrink' : 'da-expand'" ng-click="expand = !expand"></button>
</div>

CSS

.da-expand:before{
  font-family: FontAwesome;
  content:"\f107";
}
.da-shrink:before{
  font-family: FontAwesome;
  content:"\f106";
}

JavaScript

var app = angular.module("testModule", []);
 app.controller('testController', function($scope) {
	$scope.expand = true;
 });