// vim: set tw=80 ts=2 sw=2 sts=2 : import { AfterViewChecked, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'; import { NgForm } from '@angular/forms'; import { Logger } from '@nsalaun/ng-logger'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { Schedule } from './schedule'; @Component({ selector: 'schedule-form', template: `
` }) export class ScheduleFormComponent implements AfterViewChecked { @Input() schedule: Schedule; @Output() onValid: EventEmitter = new EventEmitter(); @ViewChild('form') form: NgForm; dateMask = ['2', '0', /\d/, /\d/, '-', /[0-1]/, /\d/, '-', /[0-3]/, /\d/]; constructor() {} ngAfterViewChecked() { this.onValid.emit(this.form.form.valid); } }