如果数据与ng-hide相同,如何隐藏选项中的数据?

时间:2017-11-09 15:01:52

标签: angularjs node.js

我的代码中出现了一些问题,如果数据相同则隐藏数据。

此数据1. cars形成JSON

[{ _id:1, id_ofcars:10},{ _id:2, id_ofcars:11},{ _id:3, id_ofcars:13},{ _id:4,
id_ofcars:14},{ _id:5, id_ofcars:15}]

和数据2.Owners

[{ _id:1, id_ownercars:10},{ _id:2, id_ownercars:11},{ _id:3, id_ownercars:13}]

我在controller像这样创建

app.controller('appCtrl', ['$scope','$http', function ($scope,$http) {
    function getCarsData() {
          return $http.get('api/cars');
    };
    function getOwnersData() {
         return $http.get('api/owners');
    };
getCarsData().then(function(cek){
    $scope.DataCARS = cek.data;
});
getOwnersData().then(function(cek){
      $scope.DataOWNER = cek.data;
         for (var i=0; i<$scope.DataOWNER.length; i++;){
              $scope.REALOWNER = $scope.DataOWNER[i];
         };
});

}]);

这是一个code html for options Data

<select class="form-control" name="level" id="level" ng-model="_id" ng-click="CheckSurvey(_id)" required>
    <option value="">-- SELECT DATA --</options>
    <option ng-repeat="data in DataCARS " ng-hide="data.id_ofcars ===
REALOWNER.id_ownercars" value="{{data._id}}">{{data.nama}}</option>
              </select>

为什么在loop之后我将$scope.REALOWNER.id_ownercars放入ng-hide,为什么他不隐藏id_ofcars?我只想隐藏数据?

1 个答案:

答案 0 :(得分:1)