Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: