clean(forms): cleanup

This commit is contained in:
vsavkin
2015-02-25 12:54:27 -08:00
parent f27e538e2c
commit cf9cb61665
6 changed files with 32 additions and 34 deletions
+6 -1
View File
@@ -25,7 +25,12 @@ export function controlGroupValidator(c:ControlGroup) {
var res = {};
StringMapWrapper.forEach(c.controls, (control, name) => {
if (control.active && isPresent(control.errors)) {
res[name] = control.errors;
StringMapWrapper.forEach(control.errors, (value, error) => {
if (! StringMapWrapper.contains(res, error)) {
res[error] = [];
}
ListWrapper.push(res[error], control);
});
}
});
return StringMapWrapper.isEmpty(res) ? null : res;