ngx-window-token
It is the same way how angular handle document. With this module, you can use WINDOW token just like DOCUMENT token.
Dependencies
Install
You can get it on npm.
npm install ngx-window-token --save
Build project
1. npm i
2. npm run build
Usage
If you use SystemJS to load your files, you might have to update your config:
System.config({
map: {
'ngx-window-token': 'node_modules/ngx-window-token'
}
});
In your module
imports: [ BrowserModule, WindowTokenModule ]
In your component
constructor(@Inject(WINDOW) _window) { }
For webpack / Angular CLI, it works as any other libraries. Please check demo folder for more help.
Example
plunker
Contributing
- Your commits conform to the conventions established here
- This project used commitizen and semantic-release to handle npm version from CI
- run git add first to add your changes to staging
- use
npm run commit
to commit, and CI will do the rest. - if changes contain breaking change, use
BREAKING CHANGE
keyword in the comment to trigger major release - before push to git and trigger CI, you can dry run
npm run semantic-release
locally to make sure the version number is push as expected.