JSFiddle - React, Tailwind, and code Playground

by vojtajina

HTML

<script type="text/javascript" src="http://code.angularjs.org/0.10.6/angular-0.10.6.js"></script>

<ul>
    <li ng:repeat="child in parent">
        {{child.name}} <input type="text" 
        ng:model="child.age"   />
    </li>
</ul>

<br>
array size: {{parent.length}}
<br><br>
<button ng:click="addChild()">Add Child</button>

JavaScript

function Main() {
    this.parent = [
        {"name": "joe", "age": 5},
        {"name": "joy", "age": 6}
    ];
    this.$watch('parent', function(scope, current, previous) {
        console.log(current);
    }, false);
}

Main.prototype = {
    addChild: function() {
        this.parent.push({
            "name": "jack",
            "age": 7
        });
    }
}