无法在Angular中使用Bootstrap库

时间:2018-07-24 14:55:20

标签: angular bootstrap-4

标题代码

<nav class="navbar navbar-inverse">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">WebSiteName</a>
    </div>
    <ul class="nav navbar-nav">
      <li class="active"><a href="#">Home</a></li>
      <li><a href="#">Page 1</a></li>
      <li><a href="#">Page 2</a></li>
      <li><a href="#">Page 3</a></li>
    </ul>
  </div>
</nav>

angular.json代码

"styles": [
              "src/styles.css",
              "../prab/node_modules/bootstrap/dist/css/bootstrap.min.css"
            ],

我在输出窗口中看不到引导CSS

enter image description here

3 个答案:

答案 0 :(得分:1)

或者,如果您不想更新angular.json文件,则可以按照以下方式更新styles.css文件:

salt = parseInt(sha256(previous_salt_string).substring(0, 12), 16);
//48 bits number < 2^53-1

答案 1 :(得分:0)

您需要在angular.json中添加“ node_modules / bootstrap / dist / css / bootstrap.css”

Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping

Demo

答案 2 :(得分:0)

将代码更改为:

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

已经回答,请参见

How to use Bootstrap css Library in Angular 2 project?