Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for using ngResource #188

Closed
wants to merge 1 commit into from
Closed

Conversation

skalb
Copy link
Contributor

@skalb skalb commented Nov 18, 2013

ngResource adds two fields to collections that are returned: $promise and $resolved.

This PR skips any markers with that name. I had to add this locally and figured others may run into the same issue if they are loading markers from an external service.

Technically, if someone actually named their marker either of those names it would skip, but that seems unlikely!

@houqp
Copy link
Contributor

houqp commented Nov 18, 2013

Hm, interesting. In that case I think it would be better to emit an error message to console to notify developer?

@skalb
Copy link
Contributor Author

skalb commented Nov 18, 2013

Not a bad idea...thinking about it now, maybe the API should be more forgiving. That is, if the object doesn't have either lat/lng just ignore it? On the other hand that may make it harder to debug.

Processing the entire marker list means if you use something like ngResource or Restangular you have a bunch of extra fields on the returned object that aren't markers. Any ideas on a good way to handle this?

@houqp
Copy link
Contributor

houqp commented Nov 19, 2013

oh wait, never mind, I forgot these two fileds are added by ngresources automatically ;p So I think it's safe to ignore them in that case. Otherwise, we should better emit a warning. Is there any way that we can detect whether an object is returned by ngresources?

@skalb
Copy link
Contributor Author

skalb commented Nov 20, 2013

Another option may be to allow skipInvalidMarker config that will silently ignore any markers that don't have either lat or lng.

@houqp
Copy link
Contributor

houqp commented Nov 20, 2013

Yes, introducing a config is probably the better solution (as an attribute maybe?). That way developer disable the forgiving mode in none production environment.

I just notice that not only markers has this problem, but other attributes like paths also have the same problem. Thanks for bringing up this issue :)

@skalb
Copy link
Contributor Author

skalb commented Dec 18, 2013

Closing this, as promise unwrapping is being deprecated.

angular/angular.js#4158

@skalb skalb closed this Dec 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants