-2
http://jsfiddle.net/2Ny8x/116/为什么退货不起作用?
做一个简单的应用程序。为什么我不能为$scope.incompleteCount
返回42
?
var model = { user: 'Jimmy',
items:[{ action: 'Buy Flowers', done: false},
{ action: 'Wash Car', done: false},
{ action: 'Walk Dog', done: false}]}
var ToDoApp = angular.module('ToDoApp', []);
ToDoApp.controller('TasksController', function($scope){
$scope.user = model['user'];
$scope.tasks = model['items'];
$scope.incompleteCount = function(){ return 42 };
});
HTML:
{{ user }} <!-- = 'Jimmy' -->
{{ incompleteCount }} <!-- expected 42, get nothing at all, just a blank -->
因为它是一个函数 – cbass 2014-10-22 10:43:59