Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit f1163fd

Browse files
Tim Wrightsebholstein
authored andcommitted
fix(LazyMapsApiLoader): Change OpaqueToken to InjectionToken
1 parent bf99108 commit f1163fd

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

packages/core/services/maps-api-loader/lazy-maps-api-loader.ts

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Inject, Injectable, OpaqueToken} from '@angular/core';
1+
import {Inject, Injectable, InjectionToken} from '@angular/core';
22

33
import {DocumentRef, WindowRef} from '../../utils/browser-globals';
44

@@ -14,7 +14,7 @@ export enum GoogleMapsScriptProtocol {
1414
* Token for the config of the LazyMapsAPILoader. Please provide an object of type {@link
1515
* LazyMapsAPILoaderConfig}.
1616
*/
17-
export const LAZY_MAPS_API_CONFIG = new OpaqueToken('angular-google-maps LAZY_MAPS_API_CONFIG');
17+
export const LAZY_MAPS_API_CONFIG = new InjectionToken('angular-google-maps LAZY_MAPS_API_CONFIG');
1818

1919
/**
2020
* Configuration for the {@link LazyMapsAPILoader}.
@@ -105,9 +105,13 @@ export class LazyMapsAPILoader extends MapsAPILoader {
105105
script.src = this._getScriptSrc(callbackName);
106106

107107
this._scriptLoadingPromise = new Promise<void>((resolve: Function, reject: Function) => {
108-
(<any>this._windowRef.getNativeWindow())[callbackName] = () => { resolve(); };
108+
(<any>this._windowRef.getNativeWindow())[callbackName] = () => {
109+
resolve();
110+
};
109111

110-
script.onerror = (error: Event) => { reject(error); };
112+
script.onerror = (error: Event) => {
113+
reject(error);
114+
};
111115
});
112116

113117
this._documentRef.getNativeDocument().body.appendChild(script);
@@ -142,24 +146,25 @@ export class LazyMapsAPILoader extends MapsAPILoader {
142146
region: this._config.region,
143147
language: this._config.language
144148
};
145-
const params: string =
146-
Object.keys(queryParams)
147-
.filter((k: string) => queryParams[k] != null)
148-
.filter((k: string) => {
149-
// remove empty arrays
150-
return !Array.isArray(queryParams[k]) ||
151-
(Array.isArray(queryParams[k]) && queryParams[k].length > 0);
152-
})
153-
.map((k: string) => {
154-
// join arrays as comma seperated strings
155-
let i = queryParams[k];
156-
if (Array.isArray(i)) {
157-
return {key: k, value: i.join(',')};
158-
}
159-
return {key: k, value: queryParams[k]};
160-
})
161-
.map((entry: {key: string, value: string}) => { return `${entry.key}=${entry.value}`; })
162-
.join('&');
149+
const params: string = Object.keys(queryParams)
150+
.filter((k: string) => queryParams[k] != null)
151+
.filter((k: string) => {
152+
// remove empty arrays
153+
return !Array.isArray(queryParams[k]) ||
154+
(Array.isArray(queryParams[k]) && queryParams[k].length > 0);
155+
})
156+
.map((k: string) => {
157+
// join arrays as comma seperated strings
158+
let i = queryParams[k];
159+
if (Array.isArray(i)) {
160+
return {key: k, value: i.join(',')};
161+
}
162+
return {key: k, value: queryParams[k]};
163+
})
164+
.map((entry: {key: string, value: string}) => {
165+
return `${entry.key}=${entry.value}`;
166+
})
167+
.join('&');
163168
return `${protocol}//${hostAndPath}?${params}`;
164169
}
165170
}

0 commit comments

Comments
 (0)