Skip to content

Commit

Permalink
(fix) auto-convert to number for marker input
Browse files Browse the repository at this point in the history
change from no warnings/errors/functionality to
automatically converting latitude and longitude inputs
to numbers if they are not of type number

closes sebholstein#771
  • Loading branch information
arhill05 committed Nov 3, 2017
1 parent 75bb085 commit 3294011
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/core/directives/marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,12 @@ export class AgmMarker implements OnDestroy, OnChanges, AfterContentInit {

/** @internal */
ngOnChanges(changes: {[key: string]: SimpleChange}) {
if (typeof this.latitude !== 'number' || typeof this.longitude !== 'number') {
return;
if (typeof this.latitude !== 'number') {
this.latitude = Number(this.latitude);
}

if (typeof this.longitude !== 'number') {
this.longitude = Number(this.longitude);
}
if (!this._markerAddedToManger) {
this._markerManager.addMarker(this);
Expand Down

0 comments on commit 3294011

Please sign in to comment.