UNPKG

todomvc

Version:

> Helping you select an MV\* framework

32 lines (29 loc) 623 B
/*global angular */ /*jshint unused:false */ 'use strict'; /** * The main TodoMVC app module * * @type {angular.Module} */ var todomvc = angular.module('todomvc', ['firebase']); todomvc.filter('todoFilter', function ($location) { return function (input) { var filtered = {}; angular.forEach(input, function (todo, id) { var path = $location.path(); if (path === '/active') { if (!todo.completed) { filtered[id] = todo; } } else if (path === '/completed') { if (todo.completed) { filtered[id] = todo; } } else { filtered[id] = todo; } }); return filtered; }; });