1
CoffeeScript에서 Backbone.js와 Chaplin.js를 사용합니다. 나는 도전하고있다. 라우팅 된보기에서 url 매개 변수를 가져 오는 방법은 무엇입니까?보기에서 URL url 매개 변수를 가져 오는 방법은 무엇입니까?
routes.coffee :
define ->
'use strict'
(match) ->
match "account/albums/:page", "accounts#albums"
define [
'chaplin'
'collections/albums'
'views/form_view'
'views/inline/album'
'text!template/account/_form_image.html'
'text!template/account/list_albums.html'
], (chaplin,
Albums,
FormView,
AlbumView,
formTemplate,
template
) ->
'use strict'
class AccountAlbums extends chaplin.CollectionView
collection: new Albums
itemView: AlbumView
template: template
containerMethod: 'html'
listSelector: '[data-placeholder=albums-tile]'
# TODO: understand how to get router arguments in the view
initialize: (options) ->
super
@on 'addedToDOM', => @collection.fetch()
# Need to something like this.
# But I do not know how to get it.
#@collection.fetch
# data:
# page: page