Http Requests And Pages


#1

is it possible and how to execute all http requests that pages needs on login so user doesnt wait on navigation but just wait on login.

Ex:

/* items.ts */
@IonicPage()
items: any;

ionViewWillEnter() {
    if(this.items === undefined) {
        this.itemsService.getItems().subscribe((response: Response) => {
        this.items = response['items'];
    }
}

i need this to execute on login so this.items would be already set when navigating and no spinner would be needed.

}


#2

Do the load of your data in the ItemsService creation, store the data in the itemsService object, and when calling to the getItems(), return the locally stored data.