Reputation: 493
I am playing with a javascript library called WinBoxJS. I know how to use this with plain JS. I am trying to use it in my Angular project. How can I do that?
https://www.npmjs.com/package/winbox
I installed the winbox using npm. I also included the styles and scripts in the angular.json. I acn make it work if I use the JS and CSS files and add some script in index.html. But, I want it to Angular way. Any idea?
Upvotes: 2
Views: 735
Reputation: 428
If you want, i created a wrapper for winbow which can be used in an angular project: https://www.npmjs.com/package/@rbtechdev/angular-winbox
Upvotes: 0
Reputation: 39432
DISCLAIMER: The code below works for the current version of
winbox
i.e.[email protected]
You can use it in Angular by following the steps below:
Install winbox:
npm i [email protected]
Add winbox CSS to your styles.css
/styles.scss
:
@import '~winbox/dist/css/winbox.min.css';
Add the winbox
bundle to your angular.json
scripts at path - ( projects.projectName.architect.build.options.scripts
):
"scripts": [
"node_modules/winbox/dist/winbox.bundle.js"
]
Add a declaration for WinBox to your Component. The line below declares WinBox
in app.component.ts
:
declare const WinBox: any;
Use WinBox as per their Documentation here.
Here's a Working Sample StackBlitz for your ref.
Upvotes: 4