-
Notifications
You must be signed in to change notification settings - Fork 6.7k
ng-form in ng-repeated tabs #1216
Comments
@djabor could you please provide a minimal reproduce scenario using http://plnkr.co/ ? |
The first plunkr is the initial version of the repeatable tabs directive, which contains a form within each tab. http://plnkr.co/edit/YiOLU586fglrHM0a2ws0?p=preview If you run it, you will notice that the $dirty flag of the form won't change to true when editing inputs within the tabs (fields A and B), it will, however, change when the general field is changed. This is expected 'buggy' behavior from angular as described extensively (for example here: angular/angular.js#1404) The working fix is to wrap each ng-repeated input within an ng-form directive to enable nested forms and propagate changes to the wrapping controller. http://plnkr.co/edit/pg2NJSdoF1JPmHmdpRnP?p=preview When adding the ng-form directive to the tab within ON the ng-repeated tab element or within it, will cause the error i mentioned before because the ui-bootstrap tab directive is isolated and effectively disconnects the form/ng-form |
@djabor I've just tested with the latest AngularJS version and the latest code from this library and it looks like things are in order now: http://plnkr.co/edit/6oUOfKgeLBZBX2u0PrZY?p=preview Your example is rather big so I'm not 100% sure if I'm testing the right thing. Could you please check on your end if things work as expected? If not, could you please try to trim down the reproduce scenario? |
@djabor haven't heard from you so going to close this one for now. Feel free to re-open if this is still an issue for you and you've got a reproduce scenario. |
When trying to generate multiple forms in tabs, using ng-repeats, there seems to be a collision of 2 separate bugs (1 on angularjs side, the other on ui.bootstrap (0.4.0 and 0.6.0))
to have form input validation within ng-repeat, one is required to use ng-form for each repeated element to keep the validation
using ng-form directive on tab directive breaks ngform with the
message.
Trying to fix this via #524 which, on the surface seems like the same issue, is of no help and creates an additional error of an orphaned item not being able to transclude.
The text was updated successfully, but these errors were encountered: