1

データベースから日付を取得しようとしています。そして、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ファイル(テストコード)で:

<div ng-repeat="inform in informs">
  {{inform.Ins_Check}}
</div>

これは機能しています。

質問 :

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

DBデータ(inform.Ins_Check)で、データが'O'でない場合、入力パスワードコードを表示します。または、データが「O」の場合は、「The password is Correct!」という言葉を表示します。

どのコードを入力すればよいですか?

または、別の関数を使用する必要がありますか?

4

2 に答える 2

1

ng-showそしてng-hide、真実と偽りの価値に取り組んでいます。ブール値の場合Ins_Check、0 または 1 と比較する必要はありません。単純な書き込みng-show="Ins_Check"ng-hide="!Ins_Check"

作業例はこちら

于 2015-08-11T06:03:00.493 に答える