javascript - DurandalJS how to redirect without rendering the page? -
is possible navigate page hash , logic , redirect without rendering new page/module refresh one, navigating from?
actually want logic , refresh same page without showing splash screen.
for example have simple html link:
<a class="language-link" href="#language/en-us">
in language.js have simple code 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 problem is, short period of time, loading.html viewurl property showing up. right after i'm going previous page.
i want prevent loading.html page rendering. how that? i'm travelling through durandal documentacion , searching in google, cannot find helpfull.
.then(function () { return false; });
the code above try return false activate function , prevent page rendering, not work :(
edit
i want prevent settings/loading rendering , refresh previous page navigating from.
yes can return false
using canactivate
lifecycle function (read more here)
define(['plugins/router', 'jquery'], function (router, $) { return { canactivate: function () { // logic.. // router.navigateback(); return false; } }; });
Comments
Post a Comment