I’m developing an app that requires users to login. The app will be on a device that will be shared amongst multiple users. When a user logs in, they will see private data associated with their account. They will perform typical CRUD actions on the data, then logout so that another user can log in on the same device. Prior to beta .14, I was using the state.resolve property to fetch data required by each controller (as outlined here: http://learn.ionicframework.com/formulas/data-the-right-way/). However, with beta .14, this pattern no longer works.
My question to the forum is: Is there a general data access pattern for getting data into a controller that works with the new caching mechanism, bearing in mind that the data is user specific?
I’m thinking of the following:
- Using state.resolve property to fetch user specific data (remotely or from local cache) and setting data on a service object (as opposed to injecting the data into the constructor of the controller as I was previously doing)
- Using the new $ionicView.beforeEnter event to grab the data from the service
- Upon logout, clearing the cached data in the services. When the next user logs in, the process will start again at step 1.
Does this sound reasonable?