Correct as of Summer'17
As maps
in Lightning Experience are really just objects
, you can write a little helper method to remove the key.
Here is an example: (I am using a map
to store errors from a number of child components)
deleteError : function(component, key) {
// retrieve errorMap attribute
var errorMap = component.get("v.errorMap");
// delete the key
delete errorMap[key];
// set the attribute with the new errorMap
component.set("v.errorMap", errorMap);
}
Just FYI, this is my add method:
addError : function(component, key, value) {
// retrieve errorMap attribute
var errorMap = component.get("v.errorMap");
// if it is null or undefined, trying to add
// a key generates an error, so set it as an
// empty object.
if (!errorMap) {
errorMap = {};
}
// set the key with the value
errorMap[key] = value;
// set the attribute with the new errorMap
component.set("v.errorMap", errorMap);
}
I hope this helps (please up-rate if it does ... I'm trying to build reputation ;-)
Jonathan