0

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

Shruti Nair
  • 1,982
  • 8
  • 30
  • 57
  • Check this [Link](https://rahulrsingh09.github.io/AngularConcepts/faq) or [answer](https://stackoverflow.com/a/45387777/2708210) might help – Rahul Singh Sep 21 '17 at 06:23

1 Answers1

0

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