Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

[WIP] chore(hierarchical-dependency-injection): Subscriber -> Observer #3097

Merged
merged 1 commit into from
Feb 1, 2017

Conversation

wardbell
Copy link
Contributor

@wardbell wardbell commented Jan 14, 2017

WIP - Do not merge until the question below has been answered

Current heroes.service.ts code in the form of

new Observable<Hero[]>((subscriber: Subscriber<Hero[]>) => {...}); // (1)

That conforms to the type of the parameter for Observable constructor.

But it appears that Subscriber isn't supposed to be used in "public API"
and that the conventional thing to do (which works also) is to write.

new Observable<Hero[]>((observer: Observer<Hero[]>) => {...}); // (2)

I have asked those who know which is the preferred style ... (1) or (2) ... and if (2 ... as this PR would do), why is the arg to the ctor (and to the create method) typed as Subscriber?

@wardbell wardbell changed the title chore(hierarchical-dependency-injection): Subscriber -> Observer [WIP] chore(hierarchical-dependency-injection): Subscriber -> Observer Jan 14, 2017
@wardbell
Copy link
Contributor Author

wardbell commented Feb 1, 2017

The question was answered (Paul Taylor) and the observer is preferred.

@wardbell wardbell merged commit adec6ac into angular:master Feb 1, 2017
@wardbell wardbell deleted the docs-hid-observer branch February 1, 2017 01:32
abdel-ships-it pushed a commit to abdel-ships-it/angular.io that referenced this pull request Feb 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants