toddmotto / ama

Ask me anything!
20 stars 3 forks source link

Subscribing to event emitter #78

Closed ghost closed 5 years ago

ghost commented 6 years ago

Hey Todd,

First off, thanks for the Ultimate Angular course. It's great reference material and has taught me a lot I may have skipped over when learning Angular!

Secondly, in your pro course, while talking about Inputs and Outputs on dynamic components, you subscribe to a component's event emitter. I had been following the advice from https://www.bennadel.com/blog/3038-eventemitter-is-an-rxjs-observable-stream-in-angular-2-beta-6.htm#comments_47949 and not subscribing manually. I realize that this was pre-release advice, but they have never updated their stance. What are your thoughts on this matter? Does it seem like the team will continue to use observables here?

toddmotto commented 6 years ago

Hey @solanaprojordan! Glad you're making great use of the course! I've had a few others reach out about the same topic - so it's definitely a great question! I did in fact speak to a core team earlier this year and the feedback was along the lines of "We want to make Angular more reactive, not less!". So I'd 100% say it's good to roll with for as long as I can forsee.

Let's assume that it was changed though, an EventEmitter is also very similar to a Subject - which you could always use. Try it in your code next time to see how it's a direct replacement:

@Output() prop = new Subject<string>();
ghost commented 6 years ago

Thanks! Looking forward to your ngrx stuff.

-Jordan

From: Todd Motto [mailto:notifications@github.com] Sent: Friday, November 17, 2017 3:00 PM To: toddmotto/ama ama@noreply.github.com Cc: Jordan Passmore Jordan@solanapro.com; Mention mention@noreply.github.com Subject: Re: [toddmotto/ama] Subscribing to event emitter (#78)

Hey @solanaprojordanhttps://github.com/solanaprojordan! Glad you're making great use of the course! I've had a few others reach out about the same topic - so it's definitely a great question! I did in fact speak to a core team earlier this year and the feedback was along the lines of "We want to make Angular more reactive, not less!". So I'd 100% say it's good to roll with for as long as I can forsee.

Let's assume that it was changed though, an EventEmitter is also very similar to a Subject - which you could always use. Try it in your code next time to see how it's a direct replacement:

@Output() prop = new Subject();

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/toddmotto/ama/issues/78#issuecomment-345350958, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AS8BUyjAkOR5w-EHA_2mtFIUoAc6wOVYks5s3eXNgaJpZM4Qiifr.