在使用浏览器时使用transition.abort()时URL会更新

Raj*_*Raj 3 ember.js

我是 ember 的新手,如果已经有人问过这个问题,我很抱歉。我只是想在用户离开登录表单时提示警报。当我使用 linkTo 时一切正常,但当我使用浏览器返回或手动更新 url 时,即使转换已中止,url 也会更新。我刚刚尝试过这个

杰士宾

我在 ApplicationController 中记录了 currentPath。

我不确定我出了什么问题。请建议

nar*_*eso 5

我通过使用 window.history.forward() 解决了这个问题

您可以在http://caniuse.com/#search=history上查看它的兼容性

App.ApplicationRoute = Em.Route.extend({
    actions: {
      willTransition: (transition) {
         transition.abort();

         if (window.history) {
           window.history.forward();
         }
      }
    }
});
Run Code Online (Sandbox Code Playgroud)