Conditions
by Rob Rothe
HTML
<div ng-app="app">
<div class="container" ng-controller="Controller as ctrl">
<input type="checkbox" ng-model="ctrl.thing1" ng-value="1"> Thing 1
<br>
<input type="checkbox" ng-model="ctrl.thing2" ng-value="1"> Thing 2
<hr>
<div ng-if="ctrl.checkStuff()">
Thing 1 and Thing 2 are checked!
</div>
</div>
</div>
JavaScript
angular
.module('app', [])
.controller('Controller', Controller);
function Controller() {
var vm = this;
vm.thing1 = false;
vm.thing2 = false;
vm.checkStuff = checkStuff;
function checkStuff() {
return (vm.thing1 && vm.thing2) ? 1 : 0;
}
}