html5 - window.location.assign() is not catched by Router in dart -


i try use router route_hierarchical/client.dart listen onpopstate event , enable/disable <div> in index.html. (example in stagehand.pub dart plugin) if done via normal <a href="/relativepath"> in index.html, works. if try change path via button.onclick.listen() handler in call:

window.location.assign('/relativepath'); 

i 404 , router not handling event properly. should that action not invoke popstate event caught router described here?

handlers.dart

... button.onclick.listen((_){    window.location.assign('/about'); });  ... 

router.dart

var router = new router();   router.root     ..addroute(name: 'about', path: '/about', enter: showabout)     ..addroute(name: 'login', defaultroute: true, path: '/', enter: showlogin)     ..addroute(name: 'context', path: '/context', enter: showcontext);   router.listen(); }  void showabout(routeevent e) {   // extremely simple , non-scalable way show different views.   queryselector('#login').style.display = 'none';   queryselector('#about').style.display = '';   queryselector('#context').style.display = 'none'; } ... 

index.html

... <form>     <button type="button" id="submit" disabled="true" >         login     </button> </form> ... 

onpopstate wrong event. event fired if navigate existing history entry (back, forward, pushstate, go 2nd entry in history). looking window.onhashchange event.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -