Comments (4)
This is happening to me as well, though which map gets the marker seems to be random.
from ui-leaflet.
I figured out some additional details about what is going on here.
On processing the markers for the first map, _addMarkers
(markers.js:80) is calling modelChangeInDirective
in leafletHelpers.js. This is setting the directive global watchTrap.changeFromDirective
to true
. modelChangeInDirective
uses a timeout to change that value back to false
10ms later, but that is not fast enough to prevent this code:
maybeWatch(leafletScope,'markers', watchOptions, function(newMarkers, oldMarkers){
if(watchTrap.changeFromDirective)
return;
_create(newMarkers, oldMarkers);
});
(markers.js:267-271)
...from blocking _create()
from being called on the markers for the second map.
I have no idea what modelChangeInDirective
is trying to achieve. It seems like maybe it is intended to debounce the watchers or something. Perhaps @nmccready can weigh in.
In any case, for our simple maps that don't do much with events, simply commenting out trapObj[trapField] = true;
in leafletHelpers.js:144 doesn't seem to cause any problems and allows the markers to show on multiple maps.
from ui-leaflet.
i had similar problem, but in my project, markers don't show , when i display map second (or more) time.
the problem was solved, when i add unique "group" in parker definition.
let _timeStamp = +new Date();
vm.markers = users.map((user) => {
return {
lat: user.realLatitude,
lng: user.realLongitude,
draggable: false,
icon: vm.config.local_icons.funskan_icon,
group: 'marker_group_${_timeStamp}', // here
};
});
from ui-leaflet.
Sorry to not provide feedback for so long, but I have long moved on from angular unless working on legacy projects. The main problem boils down to how leafletData is designed. It is a main bottleneck that can have race conditions and lose track of the map and or markers state themselves.
This limitation would require an entire rewrite which at this point is not worth the effort. Main reason being is that I am not using this library for work purposes any longer.
For getting multiple maps to work correctly you're going to want to implement a manager that maps DOM id's to the specific map instance.
An example:
utilized here:
from ui-leaflet.
Related Issues (20)
- leafletData.getDirectiveControls
- Dynamically add data to geoJSONShape HOT 1
- Migration to Angular 4 HOT 1
- Changin markers on scope, the model is different HOT 2
- Travis CI seems to be broken HOT 1
- Add Custom Styles To Google Maps
- layercontrol - More than 1 map on the DOM
- IE 11: US Map mouse over highlighting beside state(s)
- <Security Issue> Slack token need to be encrypted
- Fitbounds and markercluster zoom issue
- Marker in not updating its position on the map, when its value is updated
- Nor working in angular 1.6.4 HOT 2
- Popup closes when changing marker icon
- ui-leaflet analog for bindLabel functionality? HOT 1
- Could anyone propagate this commit to the 2.0.x tag version?
- MBTiles
- Disable auto center adjust after change marker coordinates programmatically
- Is this project still active ?
- Issue with Clickable Marker Content
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui-leaflet.