Here I want to access a variable or a list of variables that are passed when initializing a new view from the corresponding template.
Code example
Creating a List View
@Taskit.module "Tasks.List", (List, Taskit, Backbone, Marionette, $, _) -> class List.NewTask extends Taskit.Views.ItemView template: JST["backbone/taskit/tasks/tasks/list/_templates/new_task"]
Template for viewing the list above
<div id="new-task-form"> </div>
Initializing ItemView
view = new Taskit.Tasks.List.NewTask project_id: "project_id"
Here is my question: how can I access the variable "project_id" from my template.
<%= project_id %>
In Backbone, this can be achieved with
$(@el).html(@template({task: @model, project_id: "project_id"}))
How to do it in Marionette.js?
source share