Angular library providing wrappers for dom types.
bash
npm install ngx-dom-wrappers
or
bash
yarn add ngx-dom-wrappers
DomWrappersModule
in AppModule
or CoreModule
of your application.AppModule
```ts
@NgModule({ imports: [ // Other imports DomWrappersModule // Other imports ], }) export class AppModule { }
```
CoreModule
```ts
@NgModule({ imports: [ // Other imports DomWrappersModule // Other imports ], exports: [ // Other exports DomWrappersModule // Other exports ], }) export class CoreModule { }
```
```ts
import { WINDOW, LOCAL_STORAGE, SESSION_STORAGE } from 'ngx-dom-wrappers'
constructor( @Inject(WINDOW) windowWrapper: any, @Inject(LOCAL_STORAGE) localStorageWrapper: any, @Inject(SESSION_STORAGE) sessionStorageWrapper: any, ) { const windowObject = windowWrapper as Window if (windowObject) { // Your code } }
```
MIT