Bootstrap导航栏折叠不适用于angular4.4.4

时间:2017-10-21 12:55:42

标签: twitter-bootstrap angular navbar collapse

当我在angular4.4.4中使用bootstrap3时,bootstrap导航栏折叠不起作用,当我点击它时,拼写的内容不会显示出来。谁能帮帮我?

<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <a class="navbar-brand" href="#" >
            <img src="/assets/brand/apple-touch-icon.png" width="20" height="20" class="d-inline-block align-top" alt="">
            CottonSoft
        </a>
        <button type="button" class="navbar-toggle navbar-toggler-right" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li><a href="#">Link</a></li>
                <li class="dropdown" dropdown>
                    <a dropdownToggle class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
                    <ul *dropdownMenu class="dropdown-menu" role="menu">
                        <li role="menuitem"><a href="#">Action</a></li>
                        <li role="menuitem"><a href="#">Another action</a></li>
                        <li role="menuitem"><a href="#">Something else here</a></li>
                        <li role="separator" class="divider"></li>
                        <li role="menuitem"><a href="#">Separated link</a></li>
                    </ul>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

1 个答案:

答案 0 :(得分:5)

运行

Styles

在你的项目/ .angular-cli.json

添加以下行:

npm install  bootstrap --save
npm install jquery --save