【问题标题】:how to include salvattore javascript library in angular 2 application如何在 Angular 2 应用程序中包含 salvatore javascript 库
【发布时间】:2017-09-21 06:10:26
【问题描述】:

我知道有很多关于如何在 Angular 2 应用程序中包含 javascript 库的答案,但我的由于我不知道的原因无法正常工作。

所以我在索引文件中添加了salvattore 脚本。它的加载我在运行应用程序时检查了源文件。

<script src="~/src/js/salvattore.min.js"></script>

然后在我的组件中我添加了声明语句。不确定我是否在正确的位置添加了它 sn-p 我的组件类的外观:

@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;

下面是组件html:

<div id="grid" data-columns>
    <div>Item #1</div>
    <div>Item #2</div>
    <div>Item #3</div>
    …
    <div>Item #20</div>
</div>

我不确定我还要做什么才能使其正常工作,或者是否可能。 但是样式和列不起作用。

请指导! 谢谢

【问题讨论】:

标签: javascript angular layout


【解决方案1】:

你必须像这样安装 salvatore:

npm install salvattore --save

然后你必须在 .angular-cli.json 中设置它:

"scripts": [../node_modules/...],

祝你有美好的一天

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-01
    • 2018-02-01
    • 2017-10-20
    • 2016-12-05
    • 2019-05-06
    • 2016-10-07
    • 2017-07-05
    • 2018-01-05
    相关资源
    最近更新 更多