Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to assign templateData to rendered template instance #21

Open
arieljake opened this issue Apr 7, 2013 · 1 comment
Open

option to assign templateData to rendered template instance #21

arieljake opened this issue Apr 7, 2013 · 1 comment
Assignees
Milestone

Comments

@arieljake
Copy link

{data: true} --> newElement.data(templateData);

@ghost ghost assigned jonnyreeves Apr 7, 2013
@jonnyreeves
Copy link
Owner

The data key is already taken to represent the template data in the updated$(el).mustache() syntax; however we could use storeData: true instead, eg:

$(el).mustache({
    template: "my_template",
    data: { 
        name: "Jonny",
        colour: "blue"
    },
    method: "append"
    storeData: true
});

The template data would then be accessible from the freshly created element, via:

$(el).data("templateData").name     // Jonny.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants