[英]how to include salvattore javascript library in angular 2 application
我知道有很多关于如何在angular 2应用程序中包含javascript库的答案,但是由于我未知的原因,我的代码无法正常工作。
所以我在索引文件中添加了salvattore脚本。加载该文件时,我在运行应用程序时检查了源文件。
<script src="~/src/js/salvattore.min.js"></script>
然后在我的组件中添加了clarify语句。不确定我是否在组件类的正确位置添加了声明:
@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;
在id以下是html组件:
<div id="grid" data-columns>
<div>Item #1</div>
<div>Item #2</div>
<div>Item #3</div>
…
<div>Item #20</div>
</div>
我不确定我还要做什么才能使其正常工作,甚至可能。 但是样式和列不起作用。
请指导! 谢谢
您必须像这样安装salvattore:
npm install salvattore --save
然后必须在.angular-cli.json中进行设置,例如:
"scripts": [../node_modules/...],
祝你今天愉快
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.