为什么Bootstrap导航栏的角度表现有点不同?

时间:2017-05-22 12:46:44

标签: angular angular-ui-bootstrap

我尝试使用Angular 4的bootstrap导航栏。下面是我需要的示例菜单的代码段。

<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>
    </ul>
    <ul class="nav navbar-nav navbar-right">
      <li><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
      <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
    </ul>
  </div>
</nav>

如果我将此代码放在简单的html文件中并在网络浏览器中打开,我会正确看到菜单,如下所示:enter image description here

但是,如果我尝试在我在angular 4中创建的navbar组件中使用相同的代码并在index.html中绑定它,我会看到如下输出:

enter image description here

我在这里遗漏了什么吗?

这是我的index.html:

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>MyWebsite</title>
  <base href="/">

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

</head>
<body style="background: #e0e0eb">
  <app-root>Loading...</app-root>
</body>
</html>

另外,在app.component.html

<app-navbar></app-navbar>

0 个答案:

没有答案