0

I'm using straight dart:html and I'm looking for a way to fire a HashChangeEvent.

I'm already handling the hash change event:

  window.onHashChange.listen((HashChangeEvent e) {
    hashChange(window.location.hash);
  });

Now I'm looking for a way to change the hash when clicking on a button as example:

querySelector("#some-button").onClick.listen((e) => changeHash("#something"));

All the articles I've found so far shows how to handle the HashChangeEvent.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Jan Vladimir Mostert
  • 12,380
  • 15
  • 80
  • 137

1 Answers1

1

When you set the hash part of window.location the event is fired.

window.location.hash = 'something'
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567