angular Watch
HTML
<script src="https://code.angularjs.org/1.2.9/angular.min.js"></script>
<div ng-controller="MyCtrl"></div>
JavaScript
var myApp = angular.module('myApp',[]);
function MyCtrl ($scope) {
var testValue = null;
$scope.watchMe = null;
$scope.$watch('watchMe', function () {
console.log('testValue is', testValue);
if(testValue !== null){
console.log('i want to do something different the 2nd time this code runs - but i never get in here...');
}
testValue ="changed";
});
};