[Views] Clear regions on destroy

Clear regions when a view is destroyed. This causes a view's
destroy method to be correctly invoked, allowing views to do
cleanup. Used by NSS heatmap view for sprint Alice,
https://github.com/nasa/openmct/projects/1
This commit is contained in:
Victor Woeltjen 2017-10-19 10:57:51 -07:00
parent a2e424203a
commit e59020fec7

View File

@ -33,6 +33,7 @@ define([
link: function (scope, element, attrs) {
var region = new Region(element[0]);
scope.$watch(attrs.mctView, region.show.bind(region));
scope.$on("$destroy", region.clear.bind(region));
}
};
}