AngularJS Example:
by Facundo D
HTML
<div ng-app>
<h2>Todo</h2>
<div ng-controller="TodoCtrl">
<table border="1">
<tr ng-repeat="todo in todos">
<td>{{todo.done}}</td><td>{{todo.text}}</td><td>{{todo.test}}</td>
</tr>
</table>
<h2>JSON for Scope</h2>
<div ng-click="updJSON()">
<span>{{todoToJson}}</span>
</div>
</div>
</div>
CSS
</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ -->
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/css/bootstrap-combined.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.10/angular.min.js"></script>
<style>
.done-true {
text-decoration: line-through;
color: grey;
}
JavaScript
function TodoCtrl($scope) {
$scope.todos = [
{text:'learn angular', done:true, test: undefined},
{text:'learn more angular', done:true, test: null},
{text:'build an angular app', done:false, test: 'test'}];
$scope.updJSON = function() {
$scope.todoToJson = angular.toJson($scope.todos, true);
}
$scope.updJSON();
}