我有这样的功能:条件语句来检查,如果数组是空的,角JS
$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'属性! –