7

I have copied code directly form the Angular Bootstrap UI Plunkr

I am using a blank Angular FullStack (Mean) template for building an application.

When I use the code from the Angular Bootstrap uib-dropdown it ends up formatted incorrectly and does not work, all other angular bootstrap components seem to work fine

<!-- Single button -->
<div class="btn-group" uib-dropdown is-open="status.isopen">
  <button id="single-button" type="button" class="btn btn-primary" uib-dropdown-toggle ng-disabled="disabled">
    Button dropdown <span class="caret"></span>
  </button>
  <ul class="uib-dropdown-menu" role="menu" aria-labelledby="single-button">
    <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 class="divider"></li>
    <li role="menuitem"><a href="#">Separated link</a></li>
  </ul>
</div>

How it Looks in Angular FullStack

4

4 回答 4

11

在 bower.json 中升级 Angular UI:

"angular-bootstrap": "~0.14.3",

然后运行:

bower install
于 2015-12-26T08:06:53.147 回答
7

我通过不使用 Angular Bootstrap Dropdown 指令解决了我的问题,并使用了我在谷歌上搜索的 Bootstrap + Plain Old Angular 代码。

这对我来说很好。

    <div class="input-group">
        <div class="btn-group" ng-class='{open: open}'>
            <button class="btn btn-primary dropdown-toggle"
                    data-toggle="dropdown"
                    ng-click='open=!open'>
                Action<span class="caret"></span>
            </button>
            <ul class="dropdown-menu">
                <li ng-repeat="choice in ['the', 'quick', 'brown', 'fox']"
                    ng-click="setChoiceIndex($index);$parent.open =!$parent.open">
                    <a href="#">{{choice}}</a>
                </li>
            </ul>
        </div>
    </div>
于 2015-10-20T04:28:54.983 回答
1

我有这个问题。我将 Angular UI Bootstrap 更新到 0.14.3 版本,然后解决了这个问题。

于 2015-11-08T08:48:07.667 回答
0

您应该为每个指令使用“uib-”前缀,检查这个答案: https ://stackoverflow.com/a/34725928/3439101

于 2016-05-25T05:11:28.307 回答