mapbox.js icon indicating copy to clipboard operation
mapbox.js copied to clipboard

Angular 2 with systemjs. Mapbox is undefined

Open danfri86 opened this issue 9 years ago • 1 comments

I'm trying to set up mapbox with Angular 2 and systemjs. Can't quite get it to work yet.

Here's a plunkr: http://plnkr.co/edit/m1ZYDALqu6tFYOMDPpC7

I'm installing with npm install mapbox.js --save and mapping "mapbox.js" in systemjs.config.js, to the mapbox.js package.

In my component I'm importing with import L from 'mapbox.js';. I'm then creating a map with L.mapbox.map(this.map.nativeElement, 'mapbox.streets').setView([40, -74.50], 9); where this.map.nativeElementis the element in DOM.

I'll get error Cannot read property 'map' of undefined as you can see in the plunkr.

Anyone has any idea about what to do?

danfri86 avatar Feb 20 '17 10:02 danfri86

Hi,

This is the repository for Mapbox.js. You might be looking for angular-leaflet-directive or some other repository - Angular integration is unrelated to this codebase.

danswick avatar Feb 27 '17 23:02 danswick