I'm using leaflet to show some markers on map on my angular app.
When I first load the page the map shows ok, the problem is when I navigate to another page (with ui.router) and get back to the map page the tiles does not render anymore (all tiles are gray).
var map;
var all_coordinates;
function createMap(centrals) {
// create the tile layer with correct attribution
// set up the map
map = new L.Map('map', {
scrollWheelZoom: false
});
var baseMaps = {
"Real Image": esri,
"Roads": roads
};
roads.addTo(map);
all_coordinates = SOME_COORDINATES;
var overlayMaps = {"Name": SOME_LAYERS};
L.control.layers(baseMaps, overlayMaps).addTo(map);
//allCoordinates.push(L.latLng(37.016085, -7.933859));
map.fitBounds(all_coordinates).addLayer(centrals_layers);
return map;
}
Anyone has an ideia on what am I doing wrong?
EDIT:
Here is the route config for the map page:
$stateProvider
.state('home', {
url: "/home",
templateUrl: "/static/app/views/dashboard.html",
controller: "homeController",
resolve: {
loadPlugin: function ($ocLazyLoad) {
return $ocLazyLoad.load([
{
serie: true,
files: ['/static/vendor/datatables.net/js/jquery.dataTables.min.js',
'/static/vendor/datatables.net-bs/css/dataTables.bootstrap.min.css',
'/static/vendor/datatables.net-bs/js/dataTables.bootstrap.min.js']
},
{
serie: true,
name: 'datatables',
files: ['/static/vendor/angular-datatables/dist/angular-datatables.min.js',]
},
{
serie: true,
name: 'datatables.buttons',
files: ['/static/vendor/datatables.net-buttons/js/dataTables.buttons.min.js',
'/static/vendor/datatables.net-buttons-bs/css/buttons.bootstrap.min.css',
'/static/vendor/datatables.net-buttons-bs/js/buttons.bootstrap.min.js',
'/static/vendor/angular-datatables/dist/plugins/buttons/angular-datatables.buttons.min.js']
}
]);
}
}
})