I have created a sidemenu based app, in that after login I am displaying a number of tasks. If I click on the task it will redirect to the task details page, in that page I can update the tasks.
So after updating a task I need to go back to the previous task list page. I am using $ionicHistory.goBack();
to go back.
My problem is after come back, I need to refresh the task list i.e. updated task should not be there in the task list. How can I refresh/reload the task list?
Ionic provides the same by using <ion-refresher> component to add a pull-down feature. The <ion-refresher> component provides pull-to-refresh functionality on a content component. An Ionic allows a user to use this pattern on a list of data using touch to retrieve more data.
Press and hold all three buttons on the Ionic until you see the Fitbit logo.
One option that can boost productivity when building Ionic apps is Live Reload (or live-reload). When active, Live Reload will reload the browser or Web View when changes in the app are detected. This is particularly useful for developing using hardware devices.
By default, ionic serve boots up a development server on localhost . To serve to your LAN, specify the --external option, which will use all network interfaces and print the external address(es) on which your app is being served. Try the --lab option to see multiple platforms at once. ionic serve uses the Angular CLI.
If you bind your task to a tasks
array, which will be used in the task list
page, it should be automatically updated.
But the question is about not displaying, newly added tasks (still my previous suggestion should work) if not, performance reasons ionic views are cached, So when you come back to the previous view it doesn't go through the normal loading cycle. But you 2 options
1 - disable the caching
by using <ion-view cache-view="false" view-title="My Title!">
in your ion-view
, but this is not a very elegant solution. read more
2 - use ionRefresher
(my preferred). read more here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With