JSFiddle - React, Tailwind, and code Playground
by GruffBunny
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script>
<div ng-app='MyModule' ng-controller="MyController">
<table>
<tr ng-repeat="task in tasks">
<td>{{task.name}}</td>
<td>{{task.time}}</td>
</tr>
</table>
Name: <input type="text" ng-model='task'>
<button type='button' ng-click='addTask()'>Add task</button>
</div>
JavaScript
angular.module('MyModule', [])
.controller('MyController', function( $scope, $interval ) {
function Task(name, time) {
var self = this;
this.name = name;
this.time = time;
this.incrementTime = function() {
self.time++;
}
}
$scope.tasks = []
$scope.addTask = function() {
var task = new Task($scope.task, 0);
$interval( task.incrementTime, 1000 );
$scope.tasks.push(task);
}
});