I know there are lots of answers on how to include javascript libraries in angular 2 application,but mine is not working for reasons unknown to me.
so i have added the salvattore script in the index file.Its loading i have checked the source files when i run the application.
<script src="~/src/js/salvattore.min.js"></script>
Then in my component i have added the declare statement.Not sure if i have added it at the right place snippet of how my component class looks:
@Component({
selector: 'test-comp',
templateUrl: './test.component.html',
styleUrls: ['./test.component.css']
})
declare var salvattore: any;
export class TestComponent implements OnInit {
rightPanelTabs: any = { shedule: true, leaderboard: false };
header: any;
leftmenu: any;
rightmenu: any;
opts: ISlimScrollOptions;
blurbs: any;
_route: any;
Below id the component html:
<div id="grid" data-columns>
<div>Item #1</div>
<div>Item #2</div>
<div>Item #3</div>
…
<div>Item #20</div>
</div>
I'm not sure what else i'm suppose to do to make it working or if its even possible. But the style and columns are not working.
Please guide! Thanks
You have to install salvattore like:
npm install salvattore --save
and then you have to set it in the .angular-cli.json like :
"scripts": [../node_modules/...],
have a nice day
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.