【问题标题】:Setting the model in a nested route in Ember.js在 Ember.js 的嵌套路由中设置模型
【发布时间】:2014-05-02 17:29:11
【问题描述】:

我有一个嵌套的edit 路由:

@resource 'dashboard.communities.community', path: ':community_id', ->
  @route 'edit'

在我的路线中,我尝试使用modelFor 检索模型:

CivicSourcing.DashboardCommunitiesCommunityEditRoute = Ember.Route.extend

  model: (params, queryParams, transition) ->
    @modelFor('community')

但这会返回undefined。不过,父路由正在成功检索community。知道会发生什么吗?

【问题讨论】:

    标签: ember.js ember-data


    【解决方案1】:

    您的资源名称是 dashboard.communities.community 而不是 community

    @modelFor('dashboard.communities.community')
    

    这是colors.cool 的类似示例

    http://emberjs.jsbin.com/OxIDiVU/442/edit

    【讨论】:

    • 谢谢,这很有意义,实际上。
    猜你喜欢
    • 2013-11-04
    • 1970-01-01
    • 1970-01-01
    • 2013-01-16
    • 2012-11-18
    • 1970-01-01
    • 2013-07-20
    • 1970-01-01
    • 2015-03-18
    相关资源
    最近更新 更多