Lista de tareas bootstrap
by Alejandro M
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<!-- data-ng-app -->
<div ng-app="myExample" ng-controller="myglobalCtrl">
<h2>{{titulo}} <strong>({{todos.items.length}})</strong></h2>
<table class="table table-striped">
<thead>
<tr>
<th>Description</th> <th>Done</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in todos.items | orderBy: 'action'">
<td>{{ $index}} {{item.action}}</td>
<td>{{item.done}} <input type="checkbox" ng-model="item.done" /></td>
</tr>
</tbody>
</table>
</div>
JavaScript
var myExample = angular.module("myExample", []);
// CONTROLADOR
myExample.controller("myglobalCtrl", function ($scope) {
$scope.titulo = "Lista de tareas";
$scope.todos = model;
});
// DATOS - MODELO
var model = {
user: "Adam",
items: [
{ action: "Tomar cafe para despertar", done: false },
{ action: "Tomar nota", done: false },
{ action: "Hacer ejemplo", done: true },
{ action: "Smile", done: false }
]
};
/*function globalCtrl($scope){
$scope.titulo = "Example";
}*/