Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent history to change url after the "di.getService('page').open" is called #31

Open
vylink opened this issue Sep 22, 2018 · 1 comment

Comments

@vylink
Copy link

vylink commented Sep 22, 2018

Hi,

I'd like to prevent url change after "di.getService('page').open"
I have found working workaround, but I think there must be a better solution

            const currentUrl = window.location.href;
            this.di.getService('page').open('somepresenter/?do=someAction')
              .then((payload) => {
                di.getService('history')
                  .replace(currentUrl);
              }, (err) => {
                  //handle error
              });
@jahudka
Copy link
Member

jahudka commented Sep 23, 2018

Hi, that's actually pretty easy to do, and it's even (almost) documented:

<!-- disable history for a link or form in the template -->
<a n:href="Home:default" data-history="false">Home</a>

// disable history for a transaction initiated manually using page.open(url, method, data, context):
di.getService('page').open('/some/url', 'GET', null, { history: false });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants