我正在学习backbone.js,遇到了有趣的场景。
var EmployeeList = Backbone.Collection.extend({
url: 'http://localhost:80/employee/employee/employeelist'
});
alert('Collection created');
var employeeList = new EmployeeList();
employeeList.on("reset", function(){
alert(employeeList.length + " item(s) found");
});
employeeList.fetch();
alert(employeeList.length);
我无法理解为什么第二个警报没有正确显示长度。