Angular 2: Add validators to ngModelGroup

前端 未结 3 957
被撕碎了的回忆
被撕碎了的回忆 2021-01-13 23:08

I am using a ngModelGroup directive to group several form inputs together.

In the docs (https://angular.io/docs/ts/latest/api/forms/index/NgModelGroup-d

3条回答
  •  既然无缘
    2021-01-13 23:22

    Looks like each control in your ModelGroup should have is own validator. once this is done you might have access to each one through the validators array. so add the required attribute to the inputs that are required

提交回复
热议问题