简体   繁体   English

Angular Webpack ui-bootstrap无法拉入CSS

[英]Angular webpack ui-bootstrap not pulling in css

So I'm making an Angular application using Webpack, and I wanted to bring in bootstrap for styling. 所以,我正在使用的WebPack的角度应用,我想在引导到带来的造型。

I installed 'ui-bootstrap' using npm install angular-ui-bootstrap --save-dev , and then I imported it in app.js , and passed it as a dependency to the angular.module('myapp', [dependencies....]) . 我安装“UI-自举”使用npm install angular-ui-bootstrap --save-dev ,然后我输入它在app.js ,并通过它作为一个依赖于angular.module('myapp', [dependencies....]) That worked, and I was getting the javascript functionality for bootstrap elements. 这工作,我渐渐对引导元素的JavaScript功能。 eg toggle button was working fine. 例如切换按钮工作正常。

However, there was no styling. 但是,没有样式。 The button was styled as a regular html button. 该按钮的样式为常规的html按钮。

So, I tried doing the same thing for bootstrap with npm. 所以,我试图做同样的事情为bootstrap与NPM。 That gave me an error saying jquery not defined (I was using vanilla js), so I tried getting Jquery with npm, and that still gave me an error saying Jquery is not defined. 这给了我一个错误说的jQuery没有定义(我是用香草JS),所以我试图让与jQuery的NPM,这还是给了我一个错误说没有定义的Jquery。

What's the correct process for getting angular-ui-bootrap functionality and styling while using webpack? 什么是用于获取角度-UI-bootrap功能和造型,而使用的WebPack正确的流程?

Solution: 解:

import only the css module from bootstrap 从引导仅导入css模块

No need to inject any bootstrap elements in the angular module, since bootstrap does not have any angular components. 由于引导程序没有任何角度分量,因此无需在角度模块中注入任何引导程序元素。 Do, however, inject angular-ui-bootstrap. 但是,请注入angular-ui-bootstrap。

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

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