javascript - show/hide div in Angular -


i have date , time within 2 different div. have 2 check box 1. add additional- add 1 more div of each date , time 2. time/date same- add date div. need hide time div.

html

<input type="checkbox" ng-click="addmore(keyadd);" ng-model="keyadd"> <label for="datecheck">add additional</label> &nbsp; &nbsp; <input type="checkbox" ng-model="keyonlydate"> <label for="configdate">time/place same</label> 

controller

$scope.addmore = function(attr) {     if (attr && $scope.keycount <= 2 && $scope.keyonlydate == false) {         $scope.selects.push({});         $scope.keycount++;         $scope.keyadd = false;         $scope.keyonlydate = false;     } else if (attr && $scope.keycount <= 2 && $scope.keyonlydate == true) {         $scope.selects.push({});         $(".timepiker").hide();         $scope.keycount++;         $scope.keyadd = false;         $scope.keyonlydate = false;     } } 

i need hide timepiker based on index value only. how that?

you can use

ng-show ="expression" 

or

 ng-hide ="expression"   ng-if ="expression" //in case removed dom 

for example

<input type="checkbox" ng-click="addmore(keyadd);" ng-model = "keyadd" > <label for="datecheck" ng-if ="keyonlydate ">add additional</label> 

Comments