如何将日期选择器组件合并到formBuilder中?

时间:2018-11-11 19:07:22

标签: angular ng-bootstrap angular2-formbuilder

我有一个正在创建的表格。我遇到的问题是从组件而不是输入中验证值。我将如何去做?

public project = this.fb.group({
agent: ['', Validators.required],
lockbox: [''],
notes: [''],
owners: [''],
scheduledFor: ['', Validators.required],
address: this.fb.group({
  street: ['', Validators.required],
  city: ['', Validators.required],
  state: ['', Validators.required],
  zip: ['', Validators.required]
    }),
  });

    <form [formGroup]="project" (ngSubmit)="add(project.value)">

         <!--other stuff-->

            <label>
            scheduledFor:
            <!-- <input type="text" formControlName="scheduledFor" required> -->
            <ngbd-datepicker-basic (messageEvent)="receiveDate($event)" formControlName="scheduledFor" required></ngbd-datepicker-basic>

          </label>

        <!--other stuff-->

   <button type="submit" [disabled]="!project.valid">Submit</button>

  </form>

0 个答案:

没有答案