app/todo/todo.controller.js
function archive() {
            vm.error = undefined;
            var promises = [];
            vm.todos.filter(function (todo) {
                return todo.completed;
            }).forEach(function (todo) {
                promises.push(_archive(todo));
            });

            $q.all(promises).then(function () {
                _fetch();
            }).catch(function () {
                vm.error = 'An error occurred when archiving completed todos';
            });
        }
function archive() {
            vm.error = undefined;
            var promises = [];
            vm.todos.filter(function (todo) {
                return todo.completed;
            }).forEach(function (todo) {
                promises.push(_archive(todo));
            });

            $q.all(promises).then(function () {
                _fetch();
            }).catch(function () {
                vm.error = 'An error occurred when archiving completed todos';
            });
        }
function archive ( ) { vm . error = undefined ; var promises = [ ] ; vm . todos . filter ( function ( todo ) { return todo . completed ; } ) . forEach ( function ( todo ) { promises . push ( _archive ( todo ) ) ; } ) ; $q . all ( promises ) . then ( function ( ) { _fetch ( ) ; } ) . catch ( function ( ) { vm . error = 'An error occurred when archiving completed todos' ; } ) ; }
Archive the completed todo's.
Archive the completed todo s .