I\'m making a mobile app using Cordova and AngularJS. Currently I have installed ui-router for routing but I\'m open to any other alternative for routing.
My desire:
1) About static pages in the app (views), angular takes care of loading them.
for example: for your dashboard page you need not worry about caching the page, as angular will take care of it. Angular will only load the dashboard view once and on all next requests for the dashboard view, angular will just show you the view(not load the file for view), if it is all a static view without any data loaded by ajax calls.
2) if your dashboard is itself loading the book list(or similar data) via ajax, then you can tell your controller to only load the data once and store it to localstorage and on subsequent requests to the dashboard page can only load the data from the localStorage.
3) similar approach can be used when your BooksController
loads the data into a view. You can check in your BooksController if the request for a particular book is been previously made and if not your can store it to localstorage or database. and if the data was previously requested then you can load the same data from the storage without making a request to server.
Example situation:
say user makes request for book1, then
- your controller i.e BooksController check whether the same data was requested before,
- if not, you can load the data via the ajax call from server and also save it to local storage.
- if it was loaded before you will load the data stored in the localstorage or in the database.