0
votes

Is it possible to navigate to some page by hash and then do some logic and redirect back without rendering new page/module but REFRESH the one, where I was navigating from?

Actually what I want is to do some logic and refresh the same page without showing splash screen.

For example i have simple HTML link:

<a class="language-link" href="#language/en-US">

In language.js i have simple code which is getting data in "activate" function:

define(['plugins/router', 'jquery'], function (router, $) {
return {
    activate: function (culture) {
        return $.post("api/language", { '': culture }, function () {
            router.navigateBack();
        }).then(function () { return false; });
    },
    viewUrl: 'settings/loading'
}; });

Buty my problem is, that for a short period of time, loading.html from viewUrl property is showing up. Right after that I'm going back to previous page.

I want to prevent loading.html page from rendering. How to do that? I'm travelling through the Durandal documentacion and searching in google, but cannot find anything helpfull.

.then(function () { return false; });

The code above was my try to return false from activate function and prevent page from rendering, but does not work :(

EDIT

I want to prevent settings/loading from rendering and REFRESH previous page where I was navigating from.

1

1 Answers

0
votes

Yes you can do that by return false using canActivate lifeCycle function (Read more here)

define(['plugins/router', 'jquery'], function (router, $) {
return {
    canActivate: function () {
        // some logic..
        // router.navigateBack();              
        return false;
      }
}; });