trying to use angular
by IgorMinar
HTML
<div id ="mainPlanContainer" ng:controller="PlanListController">
<div id="planList_filter">
search: <input type="text" name="searchText" />
</div>
<table>
<thead><tr><th>name</th><th>tasks</th></tr></thead>
<tbody>
<tr ng:repeat="plan in planList.$filter({'name': searchText})">
<td>{{plan.name}}</td>
<td>{{plan.taskCount}}</td>
</tr>
</tbody>
</table>
</div>
<script>
angular.service('planList', function() {
return [{
"name": "plan Apple",
"id": 1191,
"taskCount": 0,
"description": null},
{
"name": "plan Banana",
"id": 1192,
"taskCount": 1,
"description": null}
];
});
</script>
CSS
th { font-weight: bolder }
th, td { padding: 1px 1em; }
</style>
<script src="http://code.angularjs.org/angular-0.9.14.js" ng:autobind></script>
<style>
JavaScript
// If this wasn't in jsfiddle, this would be its own source file
(function() {
function PlanListController(planList) {
this.planList = planList;
};
PlanListController.$inject = ["planList"];
angular.service('config', function() {
this.PlanListController = PlanListController;
}, {$eager:true});
}());