【问题标题】:How to gracefully redirect ember hash location to history location如何优雅地将 ember 哈希位置重定向到历史位置
【发布时间】:2013-08-24 13:49:58
【问题描述】:

我当前的 Ember 路由器正在使用 hash 位置,我想切换到使用 history 位置。我正在使用带有 thin 的 Rails 来提供应用程序并托管在 Heroku 上。

如何优雅地更改位置设置,以使用户收藏的链接不会突然中断?

我看到this solution 编辑.htaccess 文件,但据我所知,Rails doesn't run on top of Apache,所以这不是解决方案?

【问题讨论】:

    标签: ruby-on-rails apache ember.js thin pushstate


    【解决方案1】:

    我建议在客户端执行此操作。在您的应用中添加类似这样的内容:

    App = Ember.Application.create({
      ready: function() {
        if (location.hash) {
         //map known hash values to urls, redirect as needed...
        }
      }
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-25
      • 2012-07-10
      • 2016-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-31
      • 1970-01-01
      相关资源
      最近更新 更多