This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
ng-required stopped working inside ng-if or ng-repeat, version 1.7.6 #16814
Closed
Description
- [ X] bug report
ng-required stopped working,
I am using AngularJS Material tabs,
I have a condition inside each tab for "required" fields.
I have another condition for showing the tabs or not (ng-if).
plunker: http://next.plnkr.co/edit/g6tieIDq9yaEpNre
In this example, the submit button is not working, but the ng-required for the second input (the hidden one) is false!
another example with ng-repeat:
plunker: http://next.plnkr.co/edit/b7STJ5B4Ktcou83y
In this example, the submit button is not working, the second input (inside the ng repeat) is not required.
if we change angular version back to 1.7.5, its working as excepted.
AngularJS version: 1.7.6
Browser: [all ]
Thanks.
Activity
[-]ng-required stopped working on 1.7.6 gravity-manipulation (2019-01-17)[/-][+]ng-required stopped working on 1.7.6 inside ng-if or ng-repeat[/+][-]ng-required stopped working on 1.7.6 inside ng-if or ng-repeat[/-][+]ng-required stopped working inside ng-if or ng-repeat, version 1.7.6[/+]codymikol commentedon Jan 18, 2019
I can confirm that there is some kind of issue with 1.7.6 and ng-required. I have a test that fails in 1.7.6 but passes in 1.7.5
My test asserts that when I set an unrequired field to an empty value the ngModel should be $valid.
After some debugging it looks like my input has the attr ng-required="false" but also has a $error
On the input
In the input ngModelCtrl
After a bisect and symlinking to my test environment, the commit associated with this issue it 0637a21
fix(ngRequired): always evaluate ngRequired at least once
fix(ngRequired): always evaluate ngRequired at least once
frederikprijck commentedon Jan 19, 2019
Thanks for investigating it @codymikol, it looks like it's idd introduced in @Narretz commit to prevent multiple validators from initializing. Probably a good idea to get @Narretz involved in the PR review ( #16815 ).
fix(ngRequired): set error correctly when inside ngRepeat and false b…
fix(ngRequired): set error correctly when inside ngRepeat and false b…
evilaliv3 commentedon Jan 24, 2019
We confirm the issue on the GlobaLeaks as reported by some users here: globaleaks/globaleaks-whistleblowing-software#2495
13 remaining items