App.controller('todoController', function ($scope) {
// create a message to display in our view
$scope.todos = [{ name: 'angular', done: false }];
$scope.clearTodo = function () {
$scope.todos = _.filter($scope.todos, function (todo) {
return !todo.done;
});
};
});
问题-找不到符号_。我需要添加什么?谢谢!
_.filter 是 Underscore.js '实用腰带' 库的一部分。包括
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
在HTML的"头部"部分内。