ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
50.94k stars 13.52k forks source link

ion-slide-box disappeared if sliders are based on async data. #1658

Closed MaximShoustin closed 10 years ago

MaximShoustin commented 10 years ago

Test case 1 This is a single demo of ion-slide-box (grabbed from other question) that works fine: [http://codepen.io/anon/pen/sbkKh].

Test case 2 In next demo I wrapped above example with single $timeout to simulate async data populated for my slider: [http://codepen.io/anon/pen/ntEme].

If delay < 10 milliseconds - works , if > 10 sec - The slider is empty.

I tried to add $apply to fire digest cycle - doesn't help:

if($rootScope.$root.$$phase != '$apply' && $rootScope.$root.$$phase != '$digest'){
                     $rootScope.$apply(function(){   
                       //....
                     });   
                 }

Sounds like directive doesn't watch on model change and after 1st time get length =0 - does nothing

perrygovier commented 10 years ago

Hey @MaximShoustin, in order to update the index of data and slides, $ionicSlideBoxDelegate provides an update() method. More info's on the docs page

I've updated your example and everything seems to be working well.

ionitron-bot[bot] commented 6 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.