How to use the @ngneat/transloco.isBrowser function in @ngneat/transloco

To help you get started, we’ve selected a few @ngneat/transloco examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ngneat / transloco / projects / ngneat / transloco-persist-lang / src / lib / persist-lang.service.ts View on Github external
constructor(
    private service: TranslocoService,
    @Inject(TRANSLOCO_PERSIST_LANG_STORAGE) private storage: PersistStorage,
    @Inject(TRANSLOCO_PERSIST_LANG_CONFIG) private config: PersistLangConfig
  ) {
    this.storageKey = config.storageKey || 'translocoLang';

    if (isBrowser()) {
      this.init();
    }
  }
github ngneat / transloco / projects / ngneat / transloco-persist-lang / src / lib / persist-lang.service.ts View on Github external
getCachedLang(): string | null {
    return isBrowser() ? this.storage.getItem(this.storageKey) : null;
  }