1

I have a page with two modal dialogs. One is activated through data attributes, and works fine. The other is activated through a $('#myDialog').modal('show'). When I invoke this dialog, I only get the backdrop, but don't see the dialog. Closer inspection shows that the animation that brings it in from the top of the screen doesn't seem to be firing (it's still positioned off-screen). It's not the dialog itself (I've tried switching code around to bring up the "working" dialog with JS, to no avail).

Here's the code that's supposed to bring it up (coffeescript)

    $scope.unlinkAccount = (account) ->
      $('#deleteAlert').modal('show')

Here's the modal html

<div id="deleteAlert" class="modal hide fade">
    <div class="modal-header">
        <h2>Are you sure you want to unlink {{deleteTarget.token}}?</h2>
    </div>
    <div class="modal-footer">
        <button class="btn" >Cancel</button>
        <button class="btn btn-primary" ng-click="linkAccount()">Link</button>
    </div>
</div>

Idears?

6
  • Does it work without the fade class? Commented Aug 19, 2013 at 21:55
  • no - it looks like neither hide nor fade are removed Commented Aug 19, 2013 at 22:03
  • If you just call $('#deleteAlert').modal('show') on its own, does it work? Are there any other js actions that occur at the same time as the modal show? Commented Aug 19, 2013 at 23:30
  • no and no. i've tried all the variations to no avail. the only thing happening during the modal show is the snippet of code above. Commented Aug 20, 2013 at 3:45
  • Any chance there's another element on the page with ID #deleteAlert? Commented Aug 20, 2013 at 3:51

1 Answer 1

1

I'd say do not manipulate DOM in your controller code. Take the Angular way instead, which in your case would be to use Angular-UI Bootstrap. It has the $dialog service which you can leverage while keeping your controller code testable.

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

2 Comments

that's fine as a strategic direction, but doesn't solve the tactical problem.
so, i'll eat my hat here. this worked. that said - i still don't understand why, or why it should even matter.

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.