简体   繁体   English

导入对Angular CLI的依赖

[英]Import dependency on Angular CLI

I need to import some dependency on Angular CLI in my module 我需要在模块中导入对Angular CLI的一些依赖

import 'bootstrap/dist/css/bootstrap.css';
import 'jquery/dist/jquery.min.js';

it's work when i put in angular-cli.json in script: [] but when i put it in my app.module thats dependency didnt work at all. 当我在脚本中放入angular-cli.json时,它是有效的:[]但是当我将其放入app.module中时,那根本就没有依赖性。

Hopefully someone can describe what happen with my app. 希望有人可以描述我的应用程序发生了什么。

The reason why it doesn't work is because you didn't install a Typescript declaration file (aka *.d.ts ) for the associated libraries. 之所以不起作用,是因为您没有为相关的库安装Typescript声明文件(aka *.d.ts Thus, enter these commands in your console: 因此,在控制台中输入以下命令:

npm install --save @types/jquery # Install jquery type declaration
npm install --save @types/bootstrap # Install bootstrap type declaration

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM