How to hide ion-slide


#1

I am trying to hide ion-slide using ng-if but only the contents inside the ion-slide hiding .how to hide ion-slide??


#2

Hi @karthik_11294

so you want to hide single slides based on some conditions, not the ion-slider as a whole? The problem is, that during initialization of the slider, the tabs will be generated. At this point your ng-if condition has not been applied yet.
You can try to update the slider as soon as you know that all if conditions applied. You can do it like so:

$scope.$on("$ionicSlides.sliderInitialized", function(event, data){
  // grab an instance of the slider
  $scope.slider = data.slider;
});

function dataChangeHandler(){
  // call this function when data changes, such as an HTTP request, etc
  if ( $scope.slider ){
    $scope.slider.updateLoop();
  }
}

More information can be found here: http://ionicframework.com/docs/api/directive/ionSlides/