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

When I refresh a list it does not update its content #1465

Closed
rodrimmb opened this issue May 22, 2014 · 3 comments
Closed

When I refresh a list it does not update its content #1465

rodrimmb opened this issue May 22, 2014 · 3 comments

Comments

@rodrimmb
Copy link

When I refresh using pull down in a list, its content doesn't update when it finish, but the content change and when I make some other action and come back to the list it is updated.

I also have other function that add elements to the list and it works and when add elements using addInbox function also show the elements that I added previously with doRefresh.

This is the code
View:

<ion-view title="Inbox">
    <div class="bar bar-subheader bar-balanced">
        <h1 class="title">{{ inboxName }}</h1>
        <a class="button icon-left ion-android-camera" ng-click="addInbox()"></a>
    </div>

    <ion-content class="has-subheader">
        <ion-refresher
            on-refresh="doRefresh()"
            pulling-text="Pull to refresh..."
            refreshing-text="Refreshing!"
            refreshing-icon="ion-loading-c">
        </ion-refresher>
        <ion-list>
            <ion-item class="item item-avatar" ng-repeat="doc in documents" href="#/tab/inbox/{{inboxName}}/{{doc.name}}" >
                <img src="img/avanto-file-green.png">
                <h2>{{ doc.name }}</h2>
                <p>{{ doc.state }} Pages {{doc.pages}}</p>
            </ion-item>
        </ion-list>
    </ion-content>

</ion-view>

Controller:

.controller('InboxController', function($scope, $stateParams, Inbox) {
    $scope.inboxName = $stateParams.inboxName;
    $scope.documents = Inbox.all($scope.inboxName);

    $scope.doRefresh = function(){
        console.log("Cargando!!");
        $scope.documents.push({
            "name": "Documentito.pdf",
            "state": "inboxes.filestatus.ready",
            "pages": 6,
            "thumnails": [
                "/home/rodrigomanjon/files/avanto_docs/32/50/3250590bf6164addaed2d22f61442cf7"
            ]
        });
        $scope.$broadcast('scroll.refreshComplete');
    };

    $scope.addInbox = function(){
        $scope.documents.push({
            "name": "Foto.pdf",
            "state": "inboxes.filestatus.ready",
            "pages": 6,
            "thumnails": [
                "/home/rodrigomanjon/files/avanto_docs/32/50/3250590bf6164addaed2d22f61442cf7"
            ]
        });
    }
})

Sorry for my English ;)

@rodrimmb
Copy link
Author

Thank you

@mrded
Copy link

mrded commented Apr 10, 2017

Be sure to call $scope.$apply(); after $scope.documents.push(...)

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 3, 2018

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants