So, I am using Open Layers 3 with Ember.js to make a dashboard, and I've made the map load dynamically but I want it do be destroyed when I leave the route, the only thing I found was map.destroy() but its for an old version of the API and there don't seem to be one in the new version.
I used the chrome debugger after going to the map page a couple of times and found that I had 29 ol.Map objects.
This is what I have so far
App.MapView = Ember.View.extend({
map: null,
didInsertElement: function() {
this.map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.MapQuest({layer: 'sat'})
})
],
view: new ol.View({
center: ol.proj.transform([37.41, 8.82], 'EPSG:4326', 'EPSG:3857'),
zoom: 4
})
});
},
willDestroyElement: function() {
// destroy this.map
}
});
I cant find anything in the docs about removing maps.
Thanks in advance.
map.dispose()
? – Holter