我有一個rails 4 + emberjs應用程序。我試圖在燼創建嵌套的路線。我指的是http://emberjs.com/guides/routing/defining-your-routes/的'嵌套路線'部分。所有defiend路線工作正常,但'評論'的路線不工作。我現在的餘燼航線如:如何定義嵌套路由+ ember不適用於嵌套路由的渲染模板
App.Router.map ->
@resource 'posts', ->
@route 'edit',
path: '/:id/edit'
@route 'show',
path: '/:id'
@resource "comments",
path: '/:post_id/comments'
, ->
@route "new"
我有一個CommentsNewRoute文件:
App.CommentsNewRoute = Ember.Route.extend
model: (params) ->
post: @store.find 'post', params.post_id
而且有一個模板,包含「含comments.handlebars {{口}}和評論/ new.handlebars你好,世界'。在帖子模板以及同一級別中添加了places.handlebars和new.handlebars。仍然沒有渲染。
鏈接到輔助是:
{{#link-to 'comments.new' id classNames='pull-right' }}Add New Comment{{/link-to}}
的問題是:1)在CommentsNewRoute的params爲一個空對象和犯規含有POST_ID。 2)當我點擊指向'/#/ posts/2/comments/new'的鏈接時,新評論模板不會呈現。 3)如何在新評論頁面上顯示帖子的對象數據?我究竟做錯了什麼?
向我們展示你的鏈接到傭工 – 2014-11-06 11:46:16