Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Several button for the same Modal #1

Closed
jmaynier opened this issue Nov 26, 2012 · 4 comments
Closed

Several button for the same Modal #1

jmaynier opened this issue Nov 26, 2012 · 4 comments

Comments

@jmaynier
Copy link

Hi,

if I have several buttons
...

willl they refer to the same instance of modal.html or several instances. I assume the latter.
How can I have several buttons to open the same modal ?
Thanks

@mgcrea
Copy link
Owner

mgcrea commented Nov 26, 2012

Modals will inherit from their parent scope, so two buttons in the same scope with the same modal partial will open two identical modals. There will indeed be two modals in your dom, but since they are the result of the same template with the same scope applied on them, they will show similar content.

Are your buttons in the exact same scope? I could write a patch for this specific case to reuse the existing div in the dom.

@jmaynier
Copy link
Author

I have a controller in the modal, so the scope is the scope of the controller. And the buttons are in separate scope.
Before using your directive, I was doing an ng-include of the partial containing the modal, with the controller on the surrounding div inside the modal partial:

...

I was triggering events from the differents buttons controllers with $rootscope.$broadcast, those events were caught in the LoginCtrl with
$scope.$on('displayLoginModal', function () { ... })

@mgcrea
Copy link
Owner

mgcrea commented Dec 13, 2012

Please provide a Plunker (http://plnkr.co/) with an example of your issue so that I can dig more. Closing this for now.

@mgcrea mgcrea closed this as completed Dec 13, 2012
mgcrea pushed a commit that referenced this issue Nov 5, 2013
Avoid call to $apply to improve performance
amitapl pushed a commit to dmxforce/angular-strap that referenced this issue Aug 31, 2016
Reverting callback to as 2.3.2 in tooltip.show
@lock
Copy link

lock bot commented Jan 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the outdated label Jan 26, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants