This Lesson is for PRO Members.

Subscribe today and get access to all lessons! Plus direct HD download
for offline use, member comment forums, and iTunes "podcast" RSS feed.
Level up your skills now!

UNLOCK THIS LESSON

Already subscribed? Sign In

HIDE PLAYLIST

Add Operation Hooks to a LoopBack model


In this lesson we will learn how to add operation hooks to our models. In the Product model we will create a before safe observer that will check if the category we want to add the product to exists.

In our Category model we will create a before delete observer to prevent categories from being deleted when they have products.

We will create a unit test to verify that both of these operation hooks work as expected.

Please take a moment to tell your friends:

You must be a PRO Member to view code