0

I am using dropdown on Bootstrap 2.3.2 on Rails 4.0 and I am trying to keep the dropdown menu open even after clicking a button from the dropdown menu (so I only want it to close when I re-click the dropdown-toggle element)

I tried to follow the solution here https://stackoverflow.com/questions/14544741/angularjs-directive-to-stoppropagation#= to no avail...Below is what I tried to do on my html.erb to make it work. Please tell me what I am doing wrong or if you have a better working solution, let me know. Any hint would be much appreciated, thanks in advance!

<div class="dropdown">
  <a **ng-click="$event.stopPropagation();"** class="dropdown-toggle" id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="/page.html">
    Dropdown
    <b class="caret"></b>
  </a>
  <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
    <div>
      <button type="button" class="btn btn-primary" data-toggle="button">
    </di>
  </ul>
</div>
Community
  • 1
  • 1
ralphie02
  • 5
  • 6
  • Could someone please point me in the right direction? I really don't know what to d. If I need to post more things, let me know. – ralphie02 May 23 '14 at 08:14

1 Answers1

0

Shouldn't be the stop propagation applied to the clickable element itself ?

<div class="dropdown">
  <a class="dropdown-toggle" id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="/page.html">
    Dropdown
    <b class="caret"></b>
  </a>
  <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
    <div ng-click="$event.stopPropagation();">
      <button type="button" class="btn btn-primary" data-toggle="button">
    </di>
  </ul>
</div>
AlexHv
  • 1,694
  • 14
  • 21
  • I already tried that, unfortunately, it doesnt work.....I even tried to just have it in the body of my layout (outside of any div tags besides its own) and it still doesn't work....I tried to recreate this fiddle (http://jsfiddle.net/Palpatim/vuNA7/3/) in my app as well to no avail. Maybe there's something wrong with my environment?? I can't really figure out what's wrong – ralphie02 May 23 '14 at 03:39