dylanfprice / angular-gm

AngularJS Google Maps Directives
MIT License
197 stars 47 forks source link

Support for primitive lat / lng model #7

Closed bwiklund closed 11 years ago

bwiklund commented 11 years ago

Any chance of making gm-center accept a plain object, like {lat: 123, lng: 32}, instead of the google object? It would make forms and serializing settings a lot cleaner.

dylanfprice commented 11 years ago

Hmm I think I designed it this way originally but decided against it. It might make serialization easier but what if you want to use the methods on the google object (equals, toUrlValue)? Then you have the same problem in reverse. I think this is especially clear with gm-bounds where there are a lot more useful methods like extend, intersects, and union.

For serialization purposes, there are some utility methods in the angulargmUtils service, specifically 'objToLatLng' and 'latLngToObj'. I realized these don't show up in the docs so I'll work on that.