-
Notifications
You must be signed in to change notification settings - Fork 818
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -475,14 +475,11 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy { | |
} | ||
|
||
protected _updateBounds(bounds: LatLngBounds|LatLngBoundsLiteral) { | ||
if (this._isLatLngBoundsLiteral(bounds)) { | ||
if (this._isLatLngBoundsLiteral(bounds) && google && google.maps) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gionkunz
|
||
const newBounds = <LatLngBounds>google.maps.LatLngBounds(); | ||
newBounds.union(bounds); | ||
bounds = newBounds; | ||
} | ||
if (bounds.isEmpty()) { | ||
return; | ||
} | ||
if (this.usePanning) { | ||
this._mapsWrapper.panToBounds(bounds); | ||
return; | ||
|
@@ -491,7 +488,7 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy { | |
} | ||
|
||
private _isLatLngBoundsLiteral(bounds: LatLngBounds|LatLngBoundsLiteral): bounds is LatLngBoundsLiteral { | ||
return (<any>bounds).extend === undefined; | ||
return bounds != null && (<any>bounds).extend === undefined; | ||
} | ||
|
||
private _handleMapCenterChange() { | ||
|
I have a problem here, when the map is loaded lazily, accessing google will cause a reference error. Wouldn't it make sense to resolve the promise of the loader here before accessing the google namespace?