如何使用angularjs从数组中删除元素?

时间:2017-02-09 18:13:54

标签: javascript

一旦我从后端渲染数据我想从数组中删除元素id我怎么能用angularjs实现呢?

ctrl.js

$scope.array =  [{
        "name": "Java Class",
        "id": "javaClass",
        "createdBy": "shu",
        "__v": 0,
        "properties": [{
            "label": "Java Package Name",
            "type": "String",
            "editable": true,
            "binding": {
                "type": "property",
                "name": "camunda:class"
            }
        }],
        "appliesTo": ["bpmn:ServiceTask"]
    }]

1 个答案:

答案 0 :(得分:2)

您可以使用delete

delete $scope.array[0].id;