Closed
Description
Would be really helpful to track model hooks globally.
Let's say I have a list of categories to choose from, and on a different place on the screen user can delete categories. When they delete the selected category, I want to reset the scope variable.
scope.select = function (category) {
scope.selectedCategory = category
};
Category.on('before:destroy', function (attrs) {
if (scope.selectedCategory && scope.selectedCategory.id == attrs.id) {
scope.selectedCategory = null;
}
});
Another use case would be to update counters on delete/create.