【问题标题】:How to Import jasny-bootstrap to Angular 4?如何将 jasny-bootstrap 导入 Angular 4?
【发布时间】:2017-10-06 13:00:57
【问题描述】:

Jasny 引导程序:

https://github.com/jasny/bootstrap

已安装:npm install jasny-bootstrap --save

app/app.module.tsmain.ts 中导入

import * as jasny from 'jasny-bootstrap';

我收到了这个错误:

ERROR in /Users/Roller/Working/Angular4/src/app/app.module.ts (11,24): Cannot find module 'jasny-bootstrap'.

【问题讨论】:

    标签: angular jasny-bootstrap


    【解决方案1】:

    jasny-bootstrap 不是 Angular 模块,它只是 javascript 库。如果你使用 angular-cli,你可以在你的 .angular-cli.json 文件中包含这个脚本。这就是你这样做的方式:

    "scripts": [
        "../node_modules/jquery/dist/jquery.min.js",
        "../node_modules/bootstrap/dist/js/bootstrap.min.js"
    ]
    

    css 文件也一样:

    "styles": [
        "../node_modules/bootstrap/dist/js/bootstrap.min.css"
    ]
    

    【讨论】:

      猜你喜欢
      • 2019-09-21
      • 1970-01-01
      • 2018-04-20
      • 2018-03-22
      • 1970-01-01
      • 2020-03-21
      • 1970-01-01
      • 2017-02-18
      • 2018-01-26
      相关资源
      最近更新 更多