AngularJS Example:
by sathish panduga p
HTML
<div ng-app>
<h2>Please modify the values, how to watch them?</h2>
<div ng-controller="TodoCtrl">
<ul>
<li ng-repeat="col in columns">
<input type="text" ng-model="col.field" />
<input type="text" ng-model="col.displayName" />
</li>
</ul>
</div>
</div>
CSS
</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ -->
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.4/angular.min.js"></script>
<style>
.done-true {
text-decoration: line-through;
color: grey;
}
JavaScript
function TodoCtrl($scope) {
$scope.columns = [
{ field:'title', displayName: 'TITLE'},
{ field: 'content', displayName: 'CONTENT' }
];
$scope.$watch('columns', function(newVal) {
alert('columns changed');
});
}