Router Outlet caching provision


#1

I have developed single page app using Nativescript + Angular2. When user click on Shops Link with the router outlet the list of shops will be displayed. Their are 15 shops with images, but user see 11th shops details and then navigate back using router.nativigateBack() function but the list of shops reload from 1st shop. The problem is, then user need to scroll upto 12th shops to see details.

Is there is anyway that user navigate back and the scroll status is maintain?

And I know this is possible with page router outlet.
Kindly suggest some options to resolve this.


#2

It would be a lot more helpful if you shared some code, or even a sample repository.


#3

this how my app look like which single page application

User scroll the shops list and select one shop and on next page user will see shop details.
Now user click back button and then again user has to start from 1st shop.
Expected result is
The scroll should remain from where user has selected his favourite shop

Shop Component contain this

selectedShop(shop: Shop) {
this.value = shop.name;
this.data.shopInfo = shop;
this.fs.shopServiceLoaded=false;
this.fs.fiveReviews=false;
this.fs.showReviewButton=false;
this.fs.shopId = this.data.shopInfo.id;
this.fs.allpathsName = this.data.shopInfo.allpaths;
this.fs.getMyImages().subscribe(success => {
this.fs.images = success;
this.router.navigate(["/shop-info"]);
}, error => {
this.fs.disConnected = true;
this.fs.contentLoaded = false;
this.router.navigate(["/net-error"]);
});
}

ShopInfo Component contain this

let activity = application.android.startActivity ||
application.android.foregroundActivity ||
frameModule.topmost().android.currentActivity ||
frameModule.topmost().android.activity;
activity.onBackPressed = (() => {
this.router.back();

    });

#4

Same issue here, any idea how to fix it would be greatly appreciated.