5

The amount of boilerplating required to write a simple subject state service on angular.

I still love it tho. Very organized. Allows better thinking by explicitly stating the registered services in modules.

Comments
  • 0
    I can do it in 15 lines, and then it's inheritable, what are you doing?
  • 0
    @SortOfTested So this is the general system (although automated).

    Start by writing a service, make it injectable with the decorator, register it in module as a provider that you want it to be included in, additionally you need to add providers inside module that your service uses. After that register module in main under modules.

    For the usage register the service inside component's providers and finally inject it in the component's constructor.

    It's redundant in most places. It "should" theoretically work as inferred system by just having a service as injectable, registering it as provider in module and using in component.

    All these extra steps add verbosity that just help to get visual cues on what services the module/components use.

    It's quite a breeze with auto-injector plugins that do that shit for you but using a raw text editor I can imagine the frustration.
Add Comment