JSFiddle - React, Tailwind, and code Playground
by tchatel
HTML
<script src="http://code.angularjs.org/1.0.3/angular.js"></script>
<div ng-app ng-controller="Ctrl">
<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>
</div>
JavaScript
function Ctrl($scope) {
$scope.parent = [
{"name": "joe", "age": 5},
{"name": "joy", "age": 6}
];
$scope.$watch('parent', function(scope, current, previous) {
console.log(current);
}, false);
$scope.addChild: function() {
$scope.parent.push({
"name": "jack",
"age": 7
});
}
}