mercredi 14 septembre 2016

Hide/SHow if selected checkbox is true

I am writing one application where a div is having Date, Start Time, End Time and location. And i have two check box one

1- Add Additional(checkbox) - if checked then one more set of div containing the same (date,time,location) will add. 2- Time/Place will be the same(checkbox)- If i check this check box and then check the first one then only date will be added to new div. All Start time, E Time and location will be hide.

  <input type="checkbox" ng-click="addMore(keyAdd);" ng-model = "keyAdd" ng-disabled="keyCount >2" > <label for="keyAdd">Add Additional</label>
                          &nbsp;
                          &nbsp;
   <input type="checkbox"  ng-model = "keyOnlyDate" > <label for="configDate">Time/Place will be the same</label> 

My controller- In controller on click even am calling Addmore function. As per current implementation it is hiding the time/Location of current row. How to hide the next one.

  $scope.addMore = function(Attr){
     if (Attr && $scope.keyCount <= 2 && $scope.keyOnlyDate == false) {

        // $scope.selects.push({'datePicker':'','timePiker':''});
         $scope.selects.push({commDate : null,commEtime: null,commStime: null,configLoc:''});
                $(".dateContainer div.timePiker:last").show();
                $(".dateContainer label.configLocation:last").show();
                $(".dateContainer input.form-control:last").show();

         $scope.keyCount++;
         $scope.keyAdd = false;
         $scope.keyOnlyDate = false;
     }
     else if(Attr && $scope.keyCount <= 2 && $scope.keyOnlyDate == true){

         $scope.selects.push({commDate : null});

            $(".dateContainer div.timePiker:last").hide();
            $(".dateContainer label.configLocation:last").hide();
            $(".dateContainer input.form-control:last").hide();
        // $(".timePiker").hide();
         $scope.keyCount++;
         $scope.keyAdd = false;
         $scope.keyOnlyDate = false; 
     }




Aucun commentaire:

Enregistrer un commentaire