I'm new to complex angular directives. I have a variable in the rootScope called $root.page. I have set up a watch like so:
$scope.$watch(
"$root.page",
function handleChange( newValue, oldValue ) {
//show the select page only on page change
console.log(oldValue, newValue);
if (!oldValue || oldValue !== newValue) {
$scope.showSelectOnly = true;
}
}
);
The way my code is currently structured, $scope.showSelectOnly is always true. I only want $scope.showSelectOnly to be true when there is a change to $root.page and I want it to be false in all other cases (i.e. when there is no change to the $root.page variable).
$watchworked like that and you could check for 'non-changes' also. I guess this is the case for $watch over ng-change?