You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the motivation / use case for changing the behavior?
I want different url for each tab on the page but I don't want to force the user to click many times the "Back" button in order to get out of the view.
Does it exists in other libraries?
Yes. Angular UI Router has an ui-sref-opts that adds such options directly to the element. Example:
What have I tried
The obvious solution (as suggested in SO question) is not to use route-href at all but delegate the route instruction to the view model, i.e.:
I don't like this solution because it does not work with middle-click (i.e. "open in new tab").
I have triedto figure out something with additional custom attribute (say route-href-options). It should hijack the click, read the href of the element and then use the router to navigate with options. However, I am unable to do the first part with "hijacking". Even if i set onclick="return false" on the element, it is still handled with aurelia router and the view changes. Tried also with event.preventDefault(). This is what I have ended with (does not work!).
you can add route-href and a click.delegate=something($event)
check for middle button or ctrl.key state and if any, just return true,
otherwise router.navigate()
I'm submitting a feature request
One should be able to specify route options (like
trigger
orreplace
) directly in the view. For example:Related SO question
What is the motivation / use case for changing the behavior?
I want different url for each tab on the page but I don't want to force the user to click many times the "Back" button in order to get out of the view.
Does it exists in other libraries?
Yes. Angular UI Router has an
ui-sref-opts
that adds such options directly to the element. Example:The obvious solution (as suggested in SO question) is not to use
route-href
at all but delegate the route instruction to the view model, i.e.:I don't like this solution because it does not work with middle-click (i.e. "open in new tab").
I have triedto figure out something with additional custom attribute (say
route-href-options
). It should hijack the click, read thehref
of the element and then use the router to navigate with options. However, I am unable to do the first part with "hijacking". Even if i setonclick="return false"
on the element, it is still handled with aurelia router and the view changes. Tried also withevent.preventDefault()
. This is what I have ended with (does not work!).The text was updated successfully, but these errors were encountered: