Map Container is already initialized error in IONIC 2

//Munich = {lat: 28.7041, lng: 77.1025}; ='map', {
  zoom: 13,
  layers: [grayscale,streets, cities]

I am initialing openstreet map with leaflet in ionic 2. when i am loading the page again i am getting a crash i.e. map container is not initialized. it seems there is already some div present. I tried checking null also but the no success. friends please help.

Hi ashish1311,

I had the same problem 2 days ago. I don’t know if it’s the best way to fix it but I simply remove the map when the user leaves the view. Here is my code :

	document.getElementById("map").outerHTML = "";

Thank you very much…i was getting crazy bu this issue. This works.

document.getElementById(“map”).outerHTML = “”;

worked for me.