I am trying to delete an element /the last element from an array in angular. This is what a looks like
0: {geometry: {…}, symbol: {…}, attributes: {…}, infoTemplate: null, _suspended: false, …}
1: {geometry: {…}, symbol: {…}, attributes: null, infoTemplate: null}
2: {geometry: {…}, symbol: {…}, attributes: null, infoTemplate: null}
this is my function
_pushAddOperation: function (a) {
console.log("a",a);
m.forEach(
a,
d.hitch(this, function (a) {
var b = a.attributes || {};
b[this._objectIdName] = this._objectIdCounter++;
a.setAttributes(b);
this._graphicsLayer.add(a);
if (b === x) {
//deletion
a.splice(-1,1);
}
})
);
}
I am getting an error saying a.splice is not a function and I don't understand why
_pushAddOperation: function (a) {
console.log("a",a);
m.forEach(
a,
d.hitch(this, function (k) {
var b = a.attributes || {};
b[this._objectIdName] = this._objectIdCounter++;
k.setAttributes(b);
this._graphicsLayer.add(k);
if (b === x) {
//deletion
k.splice(-1,1);
}
})
);
}