如何获取选中的复选框值并根据该值动态地需要检查angularjs中的值?

时间:2015-07-28 07:04:04

标签: javascript angularjs checkbox

根据链接 - http://plnkr.co/edit/eCRsfwMEEYX5iGsraqjd?p=preview
我实现了复选框选择。现在我必须根据详细选择进行过滤

"如何获取数组中的选定值并根据所选的数组值进行过滤, 在我手动检查的每个选定值的源代码下面,但我需要动态检查。"
请任何人帮助实现这一目标。

$scope.objectFilterSubmit = function () {    

        if($scope.selected.length>1) {
             $scope.IsActive = "";
             $scope.selectedObjectDatas = $scope.getCustomObjectsBasedOnObjectTypeSelection($scope.IsActive);
             clearPartialElement();
             $scope.objectCreationPage();
        } else {
            angular.forEach($scope.selected, function(value,key){
                if(angular.equals(value, "Show Activated")) {   
                   $scope.IsActive = "true";   
                   $scope.selectedObjectDatas = $scope.getCustomObjectsBasedOnObjectTypeSelection($scope.IsActive);
                   clearPartialElement();
                   $scope.objectCreationPage();  
                }   
                else if(angular.equals(value, "Show InActivated")) {    
                     $scope.IsActive = "false";              
                     $scope.selectedObjectDatas = $scope.getCustomObjectsBasedOnObjectTypeSelection($scope.IsActive);
                     clearPartialElement();
                     $scope.objectCreationPage();   
                }
                else {
                     $scope.IsActive = "";
                     $scope.selectedObjectDatas = $scope.getCustomObjectsBasedOnObjectTypeSelection($scope.IsActive);
                     clearPartialElement();
                     $scope.objectCreationPage();
                }
            });
       }
      };

0 个答案:

没有答案