简体   繁体   English

一些自举功能无法在Angle 6项目中完全正常工作

[英]Some bootstrap features are not working fully in angular 6 project

I used this tutorial to add bootstrap to my newly created angular 6 project. 我使用教程将引导程序添加到新创建的angular 6项目中。

There is no error on compilation (neither in ng console nor in developer tool of browser). 编译没有错误(无论是在ng console还是在浏览器的开发人员工具中)。

It seem to be working because button are well colored. 因为按钮颜色很好,所以它似乎起作用了。 But compare to original code, mine is different. 但是与原始代码相比,我的是不同的。

I copied this code in my application. 我将此代码复制到了我的应用程序中。

 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"> <div class="container"> <h2>Button Styles</h2> <button type="button" class="btn">Basic</button> <button type="button" class="btn btn-default">Default</button> <button type="button" class="btn btn-primary">Primary</button> <button type="button" class="btn btn-success">Success</button> <button type="button" class="btn btn-info">Info</button> <button type="button" class="btn btn-warning">Warning</button> <button type="button" class="btn btn-danger">Danger</button> <button type="button" class="btn btn-link">Link</button> </div> 

在此处输入图片说明

But what I get in my application is this: 但是我在应用程序中得到的是: 在此处输入图片说明

I really don't know what is missing here. 我真的不知道这里缺少什么。 Any idea ? 任何想法 ?

The result in the snippet rendered buttons with white space characters and yours didn't. 代码段中的结果呈现了带有空格字符的按钮,而您的按钮却没有。

I recommend you insert white space as html code. 我建议您插入空格作为html代码。 like this: 像这样:

<button type="button" class="btn">Basic</button>&nbsp;
<button type="button" class="btn btn-default">Default</button>&nbsp;
....

尝试使用npm安装Bootstrap,而不是将其导入html。

npm install bootstrap

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

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