Hacker News new | ask | show | jobs
by WouterSpaak 1910 days ago
Angular does not use decorators to manage state. It uses decorators to create compile-time instructions for the dependency injection system to wire components, services, and directives together (I'm simplifying a bit here). Should TypeScript ever drop their decorator implementation, this could all be fairly easily changed to do it with functions instead:

  export class AppComponent { }
  
  export const appComponent = Component(AppComponent, {
    template: '<h1>Hello World!>/h1>
    // other compile-time instructions
  });
How you want to approach runtime state has nothing to do with decorators.