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

form inside modal #1022

Closed
acornejo opened this issue Sep 17, 2013 · 5 comments
Closed

form inside modal #1022

acornejo opened this issue Sep 17, 2013 · 5 comments

Comments

@acornejo
Copy link

Forms inside modals seem to be broken. I believe this is a scope/transclude issue.

Here is a minimal plunker (unable to submit form inside modal):

http://embed.plnkr.co/CGDZcFovIEJJrAsq1Sa6/

@caitp
Copy link
Contributor

caitp commented Sep 17, 2013

Try using this.form instead of $scope.form

@greggigon
Copy link

this.form does work, however, is that how it should work or is it a real bug?

@acornejo
Copy link
Author

@caitp this.form does work, however $scope.form is the angularjs way.

Perhaps the best solution would be to have the resolv parameter to the modal be a function that creates the scope used in the modalInstance.

Also I should add that in my production code, I had something that did something along the following lines:

angular.forEach(['firstname', 'lastname', 'email', 'password'], function (val) {
    $scope.$watch(val, function() {
      $scope.signupForm[val].$setValidity('server', true);
    });
  });

When using ui-bootstrap (bs3 branch) and bootstrap 3.0, the code fails because of bug exhibited by plnkr. Replacing "$scope" with "this" will not work in common scenarios like this (where this means something else). This is why I believe this is a bug that needs fixing.

@acornejo
Copy link
Author

This is a bug, but I am closing it seems it seems that its a duplicate of Issue #969

@caitp
Copy link
Contributor

caitp commented Sep 17, 2013

In the above scenario you mentioned, you are allowed to bind the callback to your controller -- you also should be able to get around this with the the 'controller as' model, if (and only if!) it's not unreasonable for that particular controller

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

No branches or pull requests

3 participants