Created
October 14, 2017 17:54
-
-
Save alexzuza/2802eae86143f0164ec4bf995ad49ee2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Directive({selector: '[ngModelGroup]', providers: [modelGroupProvider], exportAs: 'ngModelGroup'}) | |
export class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy { | |
@Input('ngModelGroup') name: string; | |
constructor( | |
@Host() @SkipSelf() parent: ControlContainer, | |
@Optional() @Self() @Inject(NG_VALIDATORS) validators: any[], | |
@Optional() @Self() @Inject(NG_ASYNC_VALIDATORS) asyncValidators: any[]) { | |
super(); | |
this._parent = parent; | |
this._validators = validators; | |
this._asyncValidators = asyncValidators; | |
} | |
/** @internal */ | |
_checkParentType(): void { | |
if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) { | |
TemplateDrivenErrors.modelGroupParentException(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment