Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

form access in the modal controller #93

Closed
viktomas opened this issue Aug 13, 2014 · 6 comments
Closed

form access in the modal controller #93

viktomas opened this issue Aug 13, 2014 · 6 comments

Comments

@viktomas
Copy link

If there is a form in modal partial view, modal window controller doesn't have an access to it.

This is codepen, in console you can see the bug (click "Open Me" and then "Tell Me")

Karan solved the problem here, but at first glance, I'm not sure that this is the easiest and the right solution.

@circlingthesun
Copy link
Contributor

Err, that codepen does not seem to work at all. A form is exposed on the containing controller's scope. So, have you tried to pass that scope in when you open the modal?

@viktomas
Copy link
Author

Sorry for not making myself clear. The codepen should illustrate the error. Which you can observe in the console.

So you are saying that the form property is on ModalDemoController's scope? I haven't tried to pass this scope to inner controller (ModalInstanceCtrl) as it doesn't make much sense to me. The inner controller has access to fields of that form in it's scope, why not the form?

@circlingthesun
Copy link
Contributor

It would help if you closed your tags. The mime time of the included js was wrong so I had to change the url. Here is a working version of your codepen:

http://codepen.io/anon/pen/EpFxe

But yeah, it seems like the form is not published to the modal controller's scope. I'm not sure why that is.

@viktomas
Copy link
Author

Thanks for the trick with putting form as an argument. Yeah, sorry for that </form> but I've spent half an hour to get all the includes working. And because I was expecting the error I've missed that one.

Anyway. I've altered my fiddle just to still keep the error obvious. And your one shows pretty neat workaround.

@sorich87
Copy link
Contributor

It's due to the way Angular handles transclusion. See angular/angular.js#5489 and angular-ui/bootstrap#969.

@konradhalas
Copy link

This $scope.$$childHead.$$nextSibling.form works for me, but I know that this is just workaround, not solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants