我有一个ng-click函数,我在第一行中打印$ scope.apiObj,这只显示控制台上的一个属性。
我正在以不同方式打印的同一对象$ scope.apiObj.project,其中显示了两个属性名称。
为什么同一对象具有这种行为?我无法删除属性Object properties。请通过图像链接查看该对象。
$scope.removeColumn = function(col) {
console.log("$scope.apiObj.project at remove col", $scope.apiObj);
$scope.apiObj = JSON.parse(JSON.stringify($scope.apiObj));
$scope.dropAreaNew.forEach(function(tem,index){
if(tem.name == col){
$scope.dropAreaNew.splice(index,1);
}
});
let indx = $scope.dropArea.indexOf(col);
$scope.dropArea.splice(indx, 1);
let indxOp = output.indexOf(col);
output.splice(indxOp, 1);
if (output.length != 0) {
console.log("$scope.apiObj.project[col]",$scope.apiObj.project);
delete $scope.apiObj.project[col];
delete $scope.dragItms[col];
$scope.removeCol = true;
console.log("after try",$scope.apiObj.project);
$scope.dropCallback();
} else {
$scope.collection = [];
$scope.columns = [];
delete $scope.apiObj.project[col];
delete $scope.dragItms[col];
$scope.removeCol = true;
$scope.dropCallback();//
}
};