MEAN Stack – AngularJS Notification Service – Day 27

The MEAN Challenge Continues!

This video is part of the 30 Day MEAN Stack Honolulu Challenge

In this video we’ll create our own notification service using an AngularJS Factory with publication and subscription methods. We’ll use this service to send messages between our Create Customer Modal, and our Customer List to refresh the list when a new customer is created.

We look at:
– Creating a new AngularJS notification Factory Service
– Setting up functionality within the Service to send a message and data
– Setting up functionality with the Service to receive a message and data
– Hooking up our Create Customer Controller with the new notification service
– Using the new notification service to send data when a new customer is created
– Hooking up our Customer List directive with the new notification service to update the list when a new customer is created
– Creating a new customer to test out our new Service

The functional design post mentioned in this video with the use case, storyboard and wireframes can be found here: Home Page Design.

4 Comments

Let me know what you think

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Roger Layton
    Reply

    Hi Shristi, I am getting through your challenge quite well, but I have hit a problem and have broken my code somewhere between the previous video and this one, and I was not commiting to Git as I should have after each video. Is the full source available someone to download? Thanks again for a great introduction to Angular and MEAN.

    • bossable

      Hey Roger,

      A couple of people have missed the return at the bottom of the Notification Service, not sure if that is causing issues for you ?

              notify.getMsg = function(msg, func, scope) {
      
              };
      
              return notify;
          }
      ]);
      

      You can find the code over here on the Selz site: https://bossable.selz.com/

  • Rafa Marfil Navarro
    Reply

    Hi Shristi!! Firstable, congratulations for this mean-stack video tutorial, it being very useful for me and you explain everything very well, I hope you keep doing more videos…. 🙂
    My question is simple, at the customerCreateController, once a record is created, after save, it cleans up all fields of the customer object, and now we’ve only added the Notify service but we no longer clean the object. The question is Why did you remove that code wich cleaned the object?

    Thank you very much, I’m really enjoyed with it!!

    • bossable

      Thanks Rafa! Regarding your question, we end up with a semi-clean scope either way. For most of my projects, I rarely explicitly clean fields after a save (even if I don’t use the notify service). The exception may be when I’m working with copy functionality to assist with data entry.

      I suggest using the 30 day challenge as a starting example, and include or remove any elements that make sense for your project.