Here is a directive I am working with:
<span ng-show="{{ save_state == 'saved' }}"> Saved </span>
<span ng-show="{{ save_state == 'saving' }}"> Saving </span>
<span ng-show="{{ save_state == 'error' }}"> Error </span>
The following functions are triggered at different times:
var saving = function() {
$scope.save_state = "saving";
$scope.$apply();
};
var saved = function() {
$scope.save_state = "saved";
$scope.$apply();
};
var error = function(err) {
alert(err);
$scope.save_state = "error";
$scope.$apply();
};
In addition, there is this line of code used for debugging purposes
<span> {{ save_state == 'saving' }} </span>
However, even when the span tag above evaluates to true
, the "Saving" span does not display. The same issue happens with the "Error" span. Why could this be?