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

Closed
justinbmeyer opened this Issue Jan 24, 2013 · 1 comment

Comments

Projects
None yet
1 participant
@justinbmeyer
Contributor

justinbmeyer commented Jan 24, 2013

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

Merge pull request #255 from bitovi/two-way-helpers
makes two way mustache helper functions possible #254
@justinbmeyer

This comment has been minimized.

Show comment
Hide comment
@justinbmeyer

justinbmeyer Jan 24, 2013

Contributor

Related: 58a0662

Contributor

justinbmeyer commented Jan 24, 2013

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