Markers not reloading on subsequent view load (ng-router issue)
When loading markers on a fresh view/controller load, markers load fine. However, when navigating away (route to new view), and then back, the markers do not reload.
Details:
- Using version 2.0.1
- Loading approx 1000 markers
- Using GoogleMapApi.then(function(maps) {}); to know when to load marker data
- Using ui-router
Observations:
- Using tilesloaded event instead from $scope.map.events works but needs a boolean condition to prevent from loading data every time tilesloaded gets called. Consider wrapping this with a promise for the "GoogleMapApi.then"
- Using $timeout inside the GoogleMapApi.then callback seems to work consistently but feels dirty
I have the same problem with 2.0.1 and ui-router. I don't use the async loading (GoogleMapApi.then (function(maps) {}). On fresh load it works fine, but when navigating through the app's stages - it's broken.
Yes, I'll look into it.
I have the same issue. Just for information, could it be possible to save the current map state before switching view and reload saved content when going back to map view?
This kind on flow:
- Home page ("/")
- Go to map page ("/map") > first load
- Go back to home page > save map state
- Go again to map page > not re-execute the directive but load cached content instead
@Shingaz That's something you will have to do yourself. No way we can/will implement this on our side
@gitnik Understood =)
have the same issue as @oktay89
Same issue showing markers with directives
Hi,
I have this exact same issue on Chrome.
On firefox, markers don't load at all and I have this error:
Error: Promise.defer is not a function
MarkerChildModel
at this line: this.deferred = Promise.defer();
Required bluebird lib seems loaded...
@mathpere us sure it is loaded prior?
I'm using browserify with this config and angular-google-maps is the only lib which is based on bluebird.
"browserify-shim": {
"angular-google-maps": {
"depends": [
"angular",
"jquery",
"lodash",
"bluebird"
]
}
/* ... */
}
Ok make sure it is using the browser version of bluebird https://github.com/petkaantonov/bluebird/tree/master/js/browser
Has anyone solved this. My markers are not visible on state change. I can confirm that they are being created, and appear on page reload, but I can't find a way around this. Thanks
@rexthepenguin As I mentioned in the original post of this issue, there are a couple of work-arounds I found that allowed me to get past the issue temporarily. I know the team is already aware of the issue and is likely working on a fix, but you may consider the options mentioned above if you need something immediately.
Same here, markers disappear :(
@ndicenso I think the fix is the Promise needs to be reset. It is resolved from the previous load. This is why timeout causes the fix as it makes it behave like the legacy code.
That makes sense. I look forward to integrating the update once it's ready. In the meantime, my half-baked work-around has not let me down. Thanks for following up.
@ndicenso how did you manage to get around it? I have the same problem. Works perfectly with around 800 markers on page reload, but when I switch states (I'm using ui-router) markers disappear.
@ionut-tanasa look at the changes on #782 to see what was changed.