đŸ’„ Angular State Management - Step-by-Step Implementation of a Store Service

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 7. 09. 2024

Komentáƙe • 15

  • @SaurabhGangamwar
    @SaurabhGangamwar Pƙed 2 lety +1

    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.

  • @TheFaceOfBoo
    @TheFaceOfBoo Pƙed 4 lety +1

    Which video is the NEXT to this, I wanna see how you applied it for the save operation.

  • @joelcipriano1985
    @joelcipriano1985 Pƙed 4 lety +5

    Isn't better to call the loadAllCourses() inside the onInit() instead of inside the constructor?
    Thanks!

    • @santinetwork8497
      @santinetwork8497 Pƙed 2 lety +1

      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.

    • @joelcipriano1985
      @joelcipriano1985 Pƙed 2 lety +1

      @@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?

    • @SaurabhGangamwar
      @SaurabhGangamwar Pƙed 2 lety

      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.

    • @santinetwork8497
      @santinetwork8497 Pƙed 2 lety

      ​@@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.

  • @ShalinDeSilva
    @ShalinDeSilva Pƙed 4 lety +2

    Where can I find the next video of handling data modification operations with sate management ?

    • @g-luu
      @g-luu Pƙed 4 lety

      course in description.

  • @rajeshhazari
    @rajeshhazari Pƙed 4 lety

    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?

    • @yt.mhasan
      @yt.mhasan Pƙed 3 lety +1

      I think this is WebStorm. Not Intellij IDEA

  • @BrunoSilva-mx1ut
    @BrunoSilva-mx1ut Pƙed 3 lety +1

    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

  • @johnsondani2010
    @johnsondani2010 Pƙed 4 lety

    Which video is the next video for save

    • @problemchild959
      @problemchild959 Pƙed 3 lety +1

      looks like the typical paywall teaser crap. getting so sick of finding these, can't afford the courses they want to tease you about.

  • @tomasdanko4718
    @tomasdanko4718 Pƙed 2 lety

    Oh jeez naming service class without service in name is confusing