AngularJS

Ternary operator digest test

HTML

<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
<div ng-controller="MyCtrl">    
    {{bool ? ternaryTrue() : ternaryFalse() }}<br/>
    
    {{bool}}<br>
    <button ng-click="bool = !bool">Toggle Bool</button>
    
    <div style="background-color:red" ng-mouseover="hover()">
    Hover here to trigger digest
    </div>
</div>

JavaScript

var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {    
    $scope.bool = true;    
   	$scope.ternaryTrue = function(){
     	console.log("ternary executed on true");   
   	}
    $scope.ternaryFalse = function(){
     	console.log("ternary executed on false");   
   	}    
    $scope.hover = function(){
    	console.log("Hover");
    }
}