javascript - Leaflet map not showing up in Backbone -
here's view:
define([ 'jquery', 'underscore', 'backbone', 'bootstrap', 'leaflet', 'text!templates/map/maptemplate.html' ], function($, _, backbone, bootstrap, l, maptemplate){ var mapview = backbone.view.extend({ el: '.body', template: _.template(maptemplate), render: function() { // load map template this.$el.html(this.template()); // create map var map = l.map('map', { dragging: false }); l.tilelayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png').addto(map); map.locate({setview: true, maxzoom: 15}); function onlocationfound(e) { var radius = e.accuracy / 2; l.marker(e.latlng).addto(map); l.circle(e.latlng, radius).addto(map); } map.on('locationfound', onlocationfound); function onlocationerror(e) { alert(e.message); } map.on('locationerror', onlocationerror); } }); return mapview; });
and underscore template has div in id of map. i'm not getting errors in console, , when check requests, it's downloading of tiles , everything, none of them getting rendered. thoughts on this?
Comments
Post a Comment