One thing regarding naming the subject. we should prefix the name of the subject it belongs to. like coursesSubject. It will be easier to read as well as in the future we can multiple subjects as needed.
CoursesStore is a service not a component. Services don't have ngCycles. There for loadAllCourses() method needs to be called on service initialization (as we only want to call it once), and this is the constructor.
I thhink loadAllCourses() method should be called in component. If we call it the constructor of the service. As services are singletone & it will call everytime our app start & at that time our user not be authenticated. & on every refresh of other pages it will call the loadAllCourses() methods due to singeletone nature of service. This approach doesn't looks scalable for medium & large scale applications.
â@@joelcipriano1985 well if called from a component yes. As @Saurabh is pointing, services are singletons (although you can alter this config in Angular) so the call of constructor is only executed once.
Why did you call this.subject instead of this.courses$ I though subject would be private and we would use this.courses$ coz it's pointed to this.subject
One thing regarding naming the subject. we should prefix the name of the subject it belongs to. like coursesSubject. It will be easier to read as well as in the future we can multiple subjects as needed.
Which video is the NEXT to this, I wanna see how you applied it for the save operation.
Isn't better to call the loadAllCourses() inside the onInit() instead of inside the constructor?
Thanks!
CoursesStore is a service not a component. Services don't have ngCycles. There for loadAllCourses() method needs to be called on service initialization (as we only want to call it once), and this is the constructor.
@@santinetwork8497 got it. Thank you, Santi!
But would not onInit() be the proper place since it is the only cycle that is called only once?
I thhink loadAllCourses() method should be called in component. If we call it the constructor of the service. As services are singletone & it will call everytime our app start & at that time our user not be authenticated. & on every refresh of other pages it will call the loadAllCourses() methods due to singeletone nature of service.
This approach doesn't looks scalable for medium & large scale applications.
â@@joelcipriano1985 well if called from a component yes. As @Saurabh is pointing, services are singletons (although you can alter this config in Angular) so the call of constructor is only executed once.
Where can I find the next video of handling data modification operations with sate management ?
course in description.
Like your video,
Thanks for good explanation.
I can see you have used intellij idea for your angular project, what is the plugin that you have used?
I think this is WebStorm. Not Intellij IDEA
Why did you call this.subject instead of this.courses$ I though subject would be private and we would use this.courses$ coz it's pointed to this.subject
Which video is the next video for save
looks like the typical paywall teaser crap. getting so sick of finding these, can't afford the courses they want to tease you about.
Oh jeez naming service class without service in name is confusing