2
AsyncValidators
には、再実行型としてObservable
が必要です。 http
リクエストはObservale
ですが、私のサーバーはtrue
またはfalse
ではなく、{uniqeTitle:true}
またはnull
という値を返します。角度4のAsyncValidatorの応答を変更する
私は自分の観測可能なものを作成する必要があります...運がない。私は完全な必要があります:私は
static uniqeTitle(fieldControl: FormControl): Observable<any> {
const subject = new Subject<any>();
apiService.get('online-validation/')
.subscribe(resp => {
subject.next(resp?null:{uniqueTitle:true});
});
return subject;
}
編集]を持っているものをここで
!