refactor(forms): make form group responsible for supporting optional controls

This commit is contained in:
vsavkin
2015-03-10 18:12:30 -07:00
parent 5acde20c7d
commit 10fb7bb05f
4 changed files with 71 additions and 93 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ export function compose(validators:List<Function>):Function {
export function controlGroupValidator(c:ControlGroup) {
var res = {};
StringMapWrapper.forEach(c.controls, (control, name) => {
if (control.active && isPresent(control.errors)) {
if (c.contains(name) && isPresent(control.errors)) {
StringMapWrapper.forEach(control.errors, (value, error) => {
if (! StringMapWrapper.contains(res, error)) {
res[error] = [];