@AfterEach
export declare let AfterEach: (Class: any, key: string, descriptor: PropertyDescriptor) => Function;
@AfterEach decorator is used to apply any business logic after each action
@Controller({
name: "home"
})
export class HomeController {
@Action("index")
processIndexAction() {
return "view";
}
@Action("edit")
processEditAction() {
return "edit";
}
@AfterEach
processAfterEachAction(@Chain data) {
return data + "-someLogic";
}
}
This will match route [home/index, home/edit, module/home/index, module/home/edit].
So in this case processAfterEachAction will be invoked on any home controller route after action chain is processed.
Expected result on home/index route will be "view-someLogic" and on edit "edit-someLogic";