Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promised data usage? #3

Open
ZachMoreno opened this issue May 30, 2015 · 2 comments
Open

Promised data usage? #3

ZachMoreno opened this issue May 30, 2015 · 2 comments

Comments

@ZachMoreno
Copy link

Hi & thank you kindly for building this useful directive for Ionic apps.
I'm running into an issue when I attempt to bind data from a factory that pulls from a remote endpoint, which works as intended within a vanilla <ion-list>. From what I can tell, the current code expects the data to already be bound to the ngModel.$viewValue object. This is, of course, not the case with remote data until the promise has been resolved. My current attempt at accomidating promised data within <ion-alpha-list> is to augment your usage of ngModel.$viewValue on line 49 of /src/ion-alpha-scroll.js with the following.

ngModel.$viewValue.$promise.then(function(items) {
    if(items.$resolved = true) {
        scope.items = items;
    }
});

the promised items object is being populated with my remote data, but it is not then being assigned to scope.items. Any help you can provide is very much appreciated & I'll be happy to contribute what I can back to this repo.

@ghost
Copy link

ghost commented May 17, 2016

+1

@alainib
Copy link

alainib commented Jan 24, 2017

if you want to use promise use ngIf

    <ion-alpha-scroll ng-if="items.length>0" ng-model="items" key="name">
        <div>{{item.name}}</div>
        <div>{{item.lastText}}</div>
    </ion-alpha-scroll>

the directive will be called only when data will be set.
ion-alpha-scroll can be edited to use watch on ng-model to update itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants