DEV Community


Discussion on: Angular Architecture: How to use Command Pattern to manage large amount of context menu actions

humberd profile image
Maciej Sawicki Author

Hey, absolutely! You can inject them in the constructor, however, when we have a very large amount of actions then the constructor would be enormous and would take up the entire screen. So having only one service injected via constructor and then inline injecting the actions makes the class more readable.

marekozw profile image

Thanks for clearing that out! I agree, code is more elegant that way.