Angular: Empty Fiddle
http://angularjs.org/
by lrvick
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="ParentCtrl">
<div data-ng-show="blah.toggleStuff">toggleStuff is true</div>
<div data-ng-hide="blah.toggleStuff">toggleStuff is false</div>
<div ng-controller="ChildCtrl">
<div data-ng-class="{'red':blah.toggleStuff,'blue':!blah.toggleStuff }">YAY COLORS</div>
<button ng-click="blah.toggleStuff=!blah.toggleStuff">toggle things</button>
</div>
</div>
CSS
.red {
background:red;
}
.blue {
background:blue;
}
JavaScript
var myApp = angular.module('myApp',[]);
function ParentCtrl($scope) {
$scope.blah = {};
$scope.blah.toggleStuff = true
}
function ChildCtrl($scope) {
}