Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Modals that contain directives that require outer controller fail #3765

Closed
raymMM opened this issue Jun 5, 2015 · 6 comments
Closed

Modals that contain directives that require outer controller fail #3765

raymMM opened this issue Jun 5, 2015 · 6 comments

Comments

@raymMM
Copy link

raymMM commented Jun 5, 2015

Problem: when a modal template contains directives that require an outer controller, this outer controller must be present in the template otherwise it will fail.
I have created a test case here: http://embed.plnkr.co/UN5gqhrdZXHmWbqDA6Xg/preview
Clicking 'Open Popup' opens the modal. Then clicking 'ok' should call a function from a required outer controller. Unfortunately it will not be found.

Reason for failure: the $modalStack.open function compiles the template content directly on the page body.

A solution would be to use a 'futureParentEl' as the parent instead of the html-body, when available.
See: 50a561a

raymMM added a commit to raymMM/bootstrap that referenced this issue Jun 5, 2015
Proposed solution for angular-ui#3765
@rvanbaalen rvanbaalen added this to the Purgatory milestone Jun 5, 2015
@raymMM
Copy link
Author

raymMM commented Jun 5, 2015

Hi Robin,
could you give me some insight on your decision to put the code in the purgatory?
BR, Ray

@rvanbaalen
Copy link
Contributor

From what I can tell in this short time it's basically an implementation issue. I'm still researching if this is an enhancement request or just a question that should be asked on StackOverflow.

That's why I put it there and didn't close it right away.

@raymMM
Copy link
Author

raymMM commented Jun 5, 2015

Thanks Robin. I think that the current implementation does not allow what I
am trying to do here. Is it a bug? Depends on whether or not the modal
should follow the same rules as ng-include for example.

Therefore I created a possible solution,
50a561a

On Fri, Jun 5, 2015 at 3:24 PM, Robin van Baalen [email protected]
wrote:

From what I can tell in this short time it's basically an implementation
issue. I'm still researching if this is an enhancement request or just a
question that should be asked on StackOverflow.

That's why I put it there and didn't close it right away.


Reply to this email directly or view it on GitHub
#3765 (comment)
.

@rvanbaalen
Copy link
Contributor

In my opinion, a modal should be self containing without parent controller dependencies. I'll ask some team members to take a look at this issue and make sure we're all on the same page.

@wesleycho
Copy link
Contributor

I do not believe we should support this. If a custom template is wanted, why not just specify this in a template and load the template with the $modal service?

This use case also has the additional issue that it is cumbersome to work with in general due to template clutter of mixed concerns.

I am inclined to reject this suggestion and close the issue, but I also would like to hear another opinion. @chrisirhc @RobJacobs @Foxandxss ?

@chrisirhc
Copy link
Contributor

Hm.. I considered supporting this but it'll be tricky.
If I understand this correctly, this is more of a feature request to support an arbitrary parent element for the modal directive.

The tricky part about this is is dealing with covering all the elements on screen. This is going to be very difficult to support.

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

4 participants