AngularJS-获取数据库数据(js)/使用ng显示(html)

AngularJS-获取数据库数据(js)/使用ng显示(html),angularjs,angularjs-ng-show,Angularjs,Angularjs Ng Show,我正试图从我的数据库中获取日期。有了这些数据,我想用ng show 在我的js文件中: httpq.post('/data/instructor.asmx/PasswordAgain', postData) .then(function(data) { $scope.informs = JSON.parse(data.d.result).Table; if ($scope.informs.length > 0) {

我正试图从我的数据库中获取日期。有了这些数据,我想用ng show

在我的js文件中:

 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");
        });
在我的html文件(测试代码)中:


{{inform.Ins_Check}
这是有效的

问题:

<div ng-show="Ins_Check != 'O'">
    Input Password : <input type="password">
</div>
<div ng-show="Ins_Check == 'O'">
    The password is Correct!
</div>

输入密码:
密码是正确的!
对于DB数据(通知。Ins_检查),如果数据不是“O”,则显示输入密码。或者,如果数据为“O”,则显示“密码正确!”

我应该输入什么代码


还是应该使用另一个函数?

ng show
ng hide
在truthy和falsy值上工作。如果
Ins\u Check
具有布尔值,则无需与0或1进行比较。简单写入
ng show=“Ins\u Check”
ng hide=“!Ins\u Check”


工作示例

很抱歉响应延迟

您使用的代码正是ng show的正确代码。您正在检查的条件变量错误

在js中,您使用了
$scope.Ins\u Checking
来分配值。但是在ng show比较中,您使用的是示例中不可用的
Ins\u Check


因此,尝试用
Ins\u Checking
替换
Ins\u Checking
。我希望这能起作用。

请始终将代码添加到您的答案中,而不仅仅是一个到plnkrHi的链接。谢谢您的回复。我从db得到了数据“O”或“X”。所以我修改代码如下<代码>什么不起作用?为什么没有else子句?它不应该是
$scope.Ins\u Checking=$scope.informs.length吗$作用域。通知[0]。Ins_检查:“O”?$scope.Ins\u检查=$scope.info.length$作用域。通知[0]。Ins_检查:“O”;
<div ng-show="Ins_Check != 'O'">
    Input Password : <input type="password">
</div>
<div ng-show="Ins_Check == 'O'">
    The password is Correct!
</div>