Excellent question! The scenario you described does work but the downside of it if that any component has public access to such variables and as a result can change the values, which can lead to unexpected side effects and code that is more difficult to maintain. A subscription from a subject prevents that and gives “read-only” access to that data. So that’s one benefit to the Subject approach. Another benefit is the ability to subscribe from Typescript code so you can react to new data outside of your templates.


Google Developer Expert in Angular, Consultant and Trainer at http://www.angulartraining.com

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store