I am trying to get date from my db. And with the data I wanna use ng-show.
In my js file :
httpq.post('/data/instructor.asmx/PasswordAgain', postData)
.then(function(data) {
$scope.informs = JSON.parse(data.d.result).Table;
if ($scope.informs.length > 0) {
$scope.Ins_Checking = $scope.informs[0];
}
})
.catch(function(data, status) {
$.showToast('error', $filter('translate')('MSG.ERROR'));
})
.finally(function() {
console.log("finally finished1");
});
In my html file(Test Code):
<div ng-repeat="inform in informs">
{{inform.Ins_Check}}
</div>
This is working.
Question :
<div ng-show="Ins_Check != 'O'">
Input Password : <input type="password">
</div>
<div ng-show="Ins_Check == 'O'">
The password is Correct!
</div>
With the DB data(inform.Ins_Check), If the data is not 'O', show Input Password code. Or if the data is 'O', show the words 'The password is Correct!'.
What code should I input?
Or should I use another function?
ng-show
andng-hide
are worked on truthy and falsy values. ifIns_Check
has Boolean value then you do not need to compare with 0 or 1. Simple writeng-show="Ins_Check"
andng-hide="!Ins_Check"
Working example here