在UIWebView中仍使用Router进行反序列化时使用Ember.NoneLocation

时间:2012-12-06 04:26:59

标签: ember.js

我的路由器看起来像这样:

App.Router = Em.Router.extend({
  enableLogging: true,
  root: Em.Route.extend({
    index: Em.Route.extend({
      route:'/',
      connectOutlets: function(router, context){
        router.get('applicationController').connectOutlet('textChallenge', App.TextChallenge.find());
      }
    }),

    textChallenge: Em.Route.extend({
      route:'/textChallenge/:challengeId',
      connectOutlets: function(router, context){
        router.get('applicationController').connectOutlet('textChallenge', context);
      },
      //this doesn't really work yet
      serialize: function(router, context){
        return{
          challengeId: context.get('challengeId')
        }
      },
      deserialize: function(router, urlParams){
        return App.TextChallenge.find(urlParams.challengeId);
      }
    })
  })
});

但是,我试图在UIWebView中运行它,并且它不喜欢要弄乱的URL(请参阅此问题:https://github.com/emberjs/ember.js/issues/1575)。我只是不太明白如何在这里实现Ember.NoneLocation。有什么想法吗?

1 个答案:

答案 0 :(得分:3)

我相信它就像在路由器location: 'none'

上设置属性一样简单