我已阅读文档,api并浏览了Ember的源代码.没运气!
路线:
App.Router.map ->
@resource 'customers', path: 'my_customers', ->
@resource 'customer', path: '/:customer_id', ->
@route 'edit', path: '/my_edit'
App.CustomerEditRoute = Ember.Route.extend
setupController: (controller, model) ->
controller.set('content', model)
alert("inspect: #{Ember.inspect(model)}")
Run Code Online (Sandbox Code Playgroud)
警报输出是"inspect:undefined"
如果我检查params,对象是空的:
App.CustomerEditRoute = Ember.Route.extend
model: (params) ->
alert("inspect: #{Ember.inspect(params)}")
Run Code Online (Sandbox Code Playgroud)
警报输出是"inspect:{}"
小智 5
动态段仅传递给客户路径,而不是嵌套的路径.所以如果你改变模型钩在你CustomerEditRoute来
model: (params) ->
return this.modelFor("customer")
Run Code Online (Sandbox Code Playgroud)
它应该工作.
(几乎相同的问题,在这里顺便说一句.)
| 归档时间: |
|
| 查看次数: |
865 次 |
| 最近记录: |