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

Mustache Helpers that accept computes and return an element should work #254

Closed
justinbmeyer opened this issue Jan 24, 2013 · 1 comment
Closed
Assignees
Milestone

Comments

@justinbmeyer
Copy link
Contributor

I want to make easy two-way binding helpers like:

(function(){

var Value = can.Control({
    init: function(){
        this.set()
    },
    "{value} change": "set",
    set: function(){
        this.element.val(this.options.value())
    },
    "change": function(){
        this.options.value(this.element.val())
    }
})

can.Mustache.registerHelper('value', function(value){
    return function(el){
        new Value(el, {value: value});
    }
});

})()
<input {{value user.name}}/>

But this is currently not possible because user.name's value will be passed as value to the mustache helper instead of a compute.

@ghost ghost assigned justinbmeyer Jan 24, 2013
justinbmeyer added a commit that referenced this issue Jan 24, 2013
makes two way mustache helper functions possible #254
@justinbmeyer
Copy link
Contributor Author

Related: 58a0662

justinbmeyer added a commit that referenced this issue Jan 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant