【发布时间】:2015-07-01 22:35:56
【问题描述】:
我有这个功能:
$scope.doPaste = function(destination) {
if ($scope.selectCopy.ids != []) {
console.log("will copy");
$scope.CopyFiles(destination);
}
if ($scope.selectMove.ids != []) {
console.log("will move");
$scope.MoveFiles(destination);
}
};
在我的应用中,$scope.selectMove.ids 和 $scope.selectCopy.ids 不能都为非空。我的意思是,例如当$scope.selectMove.ids 为非空时$scope.selectCopy.ids 为空。
我的问题是在控制台中,我总是看到两者都会复制和移动。
【问题讨论】:
-
你最好检查
.length属性!
标签: javascript arrays angularjs