Ошибка angular 6 при попытке вставить Window в компонент на IE11 - PullRequest
0 голосов
/ 05 июня 2018

Я получаю следующую ошибку в IE:

SCRIPT5022: Не удается разрешить все параметры для StorageService: ([объект объекта],?).

Isпрокладка, необходимая только для подачи window
Угловое приложение объявляет StorageService следующим образом:

@Injectable()
export class StorageService implements IStorageService {

    /**
     * @constructor create new storage service.
     * @param window the window.
     */
    constructor(
        private readonly logger: NGXLogger,
        private readonly window: Window) {
    }

    /**
     * clear the token with the supplied key.
     * @param key a string containing the key.
     */
    clear(token: string) {
        window.localStorage.removeItem("token");
    }

    /**
     * load a value using the supplied key.
     * @param key a string
     * @returns {T} the stored value, or null;
     */
    load<T>(key: string): T {
        try {
            const value = window.localStorage.getItem(key);
            if (value === undefined || value === null || value === "undefined")
                return null;

            const instance = JSON.parse(value);
            return instance as T;
        } catch (exception) {
            this.logger.warn(`error obtaining key [${key}] :: ${exception}`);
            return null;
        }
    }

    /**
     * save the supplied value under the supplied key.
     * @param key the key.
     * @param value the value.
     * @returns {T} the supplied value
     */
    save<T>(key: string, value: T): T {
        window.localStorage.setItem(key, JSON.stringify(value));
        return value;
    }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...