我在 Controller 中创建了一个自定义过滤器,但无法获取迭代 json 的索引或大小。调用 program.length
让我未定义。有什么想法吗?
$scope.filterFn = function(program){
if(case){
return true;
}
console.log(program.length);//undefined
return false;
};
最佳答案
尝试使用此代码来获取对象长度。
Object.keys(program).length;
关于javascript - AngularJS - 在自定义过滤器中获取对象索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37726724/