Currently, I am encountering an issue with ng-if when using the following code:
<ion-slide-box ng-if="sencillo.length && sencillo[$index].custom_sound_path" on-slide-changed="slideHasChanged(sencillo[$index].custom_sound_path)" class="fondo-rojo" show-pager="false" does-continue="true">
<ion-slide on-swipe-right="setR({{sencillo}},$index)" on-swipe-left="setL({{sencillo}},$index)" ng-repeat="senci in sencillo" repeat-done="repeatDone()">
<h1 class="margen-slide slide-estilo">{{senci.title}}</h1>
<div style="margin: 0 auto; width:70px" >
<a ng-click="play(senci.custom_sound_path)"><img ng-src="img/sonidos/play.png" width="70px" height="70px"></a>
<!--<button ng-click="nextSlide()"> >> </button>-->
</div>
</ion-slide>
</ion-slide-box>
<ion-slide-box ng-if="sencillo.length && !sencillo[$index].custom_sound_path" on-slide-changed="slideHasChanged('/android_asset/www/raw/'+sencillo[$index].sound_title+'.mp3')" class="fondo-rojo" show-pager="false" does-continue="true">
<ion-slide on-swipe-right="setR({{sencillo}},$index)" on-swipe-left="setL({{sencillo}},$index)" ng-repeat="senci in sencillo" repeat-done="repeatDone()">
<h1 class="margen-slide slide-estilo">{{senci.title}}</h1>
<div style="margin: 0 auto; width:70px" >
<a ng-click="play('/android_asset/www/raw/'+senci.sound_title+'.mp3')"><img ng-src="img/sonidos/play.png" width="70px" height="70px"></a>
<!--<button ng-click="nextSlide()"> >> </button>-->
</div>
</ion-slide>
</ion-slide-box>
I am attempting to check if sencillo[$index].custom_sound_path exists. If it does, then run the first slidebox, otherwise run the second slidebox. The problem lies in the fact that the ng-if always detects sencillo[$index].custom_sound_path as a null value, causing only the second slidebox to be executed. Strangely, this method works perfectly in a different view, as shown below:
<div ng-if="editsimpleRow.custom_sound_path">
<a ng-click="play(editsimpleRow.custom_sound_path)"><img ng-src="img/sonidos/play.png" width="40px" height="40px"></a>
<!--<a ng-click="play(editsimple.custom_sound_path)"><img ng-src="img/sonidos/play.png" width="40px" height="40px"></a>-->
</div>
<div ng-if="!editsimpleRow.custom_sound_path">
<a ng-click="play('/android_asset/www/raw/'+editsimpleRow.sound_title+'.mp3')"><img ng-src="img/sonidos/play.png" width="40px" height="40px"></a>
</div>
The only apparent difference is the $index value. Any assistance or insights would be greatly appreciated. Thank you, and please excuse any language difficulties.