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 Answers 4

11

Upgrade Angular UI in bower.json:

"angular-bootstrap": "~0.14.3",

Then run:

bower install
Sign up to request clarification or add additional context in comments.

2 Comments

This breaks the navbar. To fix it you will need to edit navbat.html and change <div collapse...> to <div uib-collapse...>
In my case I also had to tweak <ul class="uib-dropdown-menu"> to read: <ul uib-dropdown-menu>. Just my 2c.
7

I have solved my problem by not using the Angular Bootstrap Dropdown directive and gone with Bootstrap + Plain Old Angular code which I googled.

This is working fine for me.

    <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>

1 Comment

This solution doesn't close the dropdown when you click elsewhere in the browser
1

I had this problem. I updated Angular UI Bootstrap to 0.14.3 version & then resolved the problem.

Comments

0

You should use 'uib-' prefix for each directive, check this answer: https://stackoverflow.com/a/34725928/3439101

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.