>From this:
1. $scope.archive = function() {
2. var oldTodos = $scope.todos;
3. $scope.todos = [];
4. angular.forEach(oldTodos, function(todo) {
5. if (!todo.done) $scope.todos.push(todo);
6. });
7. };
To this
1. $scope.archive = function() {
2. $scope.todos = $scope.todos.filter(function(element){
3. return !element.done;
4. });
5. };
I think the second example is much more simple! any thought?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.