Two way binding

Two-way binding facilitates the information sharing between a JavaScript variable and an HTML element and vice verse. The natural way is for example binding an onchange event to a element form to update a JS Variable, them when changing the variable applying that back to the HTML form. When dealing with several element forms that would escalate to a very time consume job to create and maintain.

The Lemonadejs brings two-way binding natively, so for each update in the property of a self would be applied to the correspondend elements in the view and vice verse.

A very common usage is when the developer needs the values of element forms back to the self. That can be easily archivable using events for the elements in the form, for example:

<input type='text' name='email' value='' onchange=' = this.value'>

<script src=""></script>

<div id='root'></div>

var myComponent = (function() {
    var self = {}; = 'Roger Rabbit';
    self.valid = true;

    var template = `<div>
        <div>Name: {{}}</div>
        <div>Checked: {{self.valid}}</div><br/>
            <input type="text" value="1" @bind="" />
            <input type="checkbox" value="1" @bind="self.valid" />

    return lemonade.element(template, self);

lemonadejs.render(myComponent, document.getElementById('root'));