I'm setting a $scope variable to 0 or 1 based on a successful action and showing elements with ng-show. I'm resetting the $scope variable to empty when the step is finished. However, I have discovered that $scope = '' is shown as true if in interpolation {{$scope >= 0}}. Why not false?
controllers.Ctrl = function ($scope, $rootScope, $timeout, $filter, ajax, $parse) {
$scope.datachanged = '';
console.log($scope.datachanged >= 0); // true
};
That's just javascript for you.
'' >= 0will evaluate totrue. This is because the empty string''is falsy, and so is 0, so you can think of it asfalse >= false.Instead, why don't you reset the variable to
undefined(ie$scope.datachanged = undefined).undefined >= 0will evaluate tofalse.Alternatively, if the variable will only be set to 0 or 1, you could also just check to see if your variable equals 1 where you do the interpolation.
{{datachanged === 1}