Skip to content

Commit

Permalink
fix: ngModel should use rxjs/symbol/observable to detect observable (#…
Browse files Browse the repository at this point in the history
…14236)

PR closes #14236
  • Loading branch information
mhevery committed Feb 3, 2017
1 parent 83dafd3 commit 7e639aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/@angular/forms/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {fromPromise} from 'rxjs/observable/fromPromise';
import {composeAsyncValidators, composeValidators} from './directives/shared';
import {AsyncValidatorFn, ValidatorFn} from './directives/validators';
import {EventEmitter, Observable} from './facade/async';
import {isPromise} from './private_import_core';
import {isObservable, isPromise} from './private_import_core';



/**
Expand Down Expand Up @@ -419,7 +420,7 @@ export abstract class AbstractControl {
this._status = PENDING;
this._cancelExistingSubscription();
const obs = toObservable(this.asyncValidator(this));
if (!(obs instanceof Observable)) {
if (!(isObservable(obs))) {
throw new Error(
`expected the following validator to return Promise or Observable: ${this.asyncValidator}. If you are using FormBuilder; did you forget to brace your validators in an array?`);
}
Expand Down
1 change: 1 addition & 0 deletions modules/@angular/forms/src/private_import_core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
import {__core_private__ as r} from '@angular/core';

export const isPromise: typeof r.isPromise = r.isPromise;
export const isObservable: typeof r.isObservable = r.isObservable;

0 comments on commit 7e639aa

Please sign in to comment.