Skip to content

Commit

Permalink
closes #271
Browse files Browse the repository at this point in the history
  • Loading branch information
udos86 committed Feb 20, 2017
1 parent 13c7744 commit aaff8ec
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/core/src/service/dynamic-form.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ import { DYNAMIC_FORM_CONTROL_TYPE_SLIDER, DynamicSliderModel } from "../model/s
import { DYNAMIC_FORM_CONTROL_TYPE_SWITCH, DynamicSwitchModel } from "../model/switch/dynamic-switch.model";
import { DYNAMIC_FORM_CONTROL_TYPE_TEXTAREA, DynamicTextAreaModel } from "../model/textarea/dynamic-textarea.model";
import { isFunction, isDefined } from "../utils";
import { DYNAMIC_FORM_CONTROL_TYPE_FILE_UPLOAD, DynamicFileUploadModel } from "../model/file-upload/dynamic-file-upload.model";
import {
DYNAMIC_FORM_CONTROL_TYPE_FILE_UPLOAD,
DynamicFileUploadModel
} from "../model/file-upload/dynamic-file-upload.model";

export class DynamicFormService {

Expand All @@ -55,7 +58,10 @@ export class DynamicFormService {
let validatorFn;

if (this.NG_VALIDATORS) {
validatorFn = this.NG_VALIDATORS.find(validator => validatorName === validator.name);

validatorFn = this.NG_VALIDATORS.find(validator => {
return (validatorName === validator.name) || ((validator(new FormControl()) as any).hasOwnProperty(validatorName));
});
}

if (!isDefined(validatorFn) && this.NG_ASYNC_VALIDATORS) {
Expand Down

0 comments on commit aaff8ec

Please sign in to comment.