[Solved] V2 Cannot Refresh Current Page

I was using the following code in V1 to refresh the current page can someone help me with the new code for V2 as hours of trial and error have failed:

var current_view = app.getCurrentView();
current_view.router.refreshPage();

Thanks in advance!

view.router.navigate(view.router.currentRoute.url, {
        ignoreCache  : true,
        reloadCurrent : true
    });
3 Likes

Worked a charm! Thanks so much for the fast response

For below case am getting view is not defined error.

$$(document).on('online', function () {
	var toastBottom = app.toast.create({
			text: 'Device is online.',
			closeTimeout: 3000
		})
		toastBottom.open();

	view.router.navigate(view.router.currentRoute.url, {
		ignoreCache: true,
		reloadCurrent: true
	});

})

Your view is the one you declare on top

EXAMPLE in my case is mainView

var mainView = app.views.create(’.view-main’, {
url: β€˜/’
});