1

In Angular, you use @Component({ selector: '...', ... }) when creating a new component.

I am just curious what this @Component actually is. Just a normal function call? Is this a valid name for a normal function?

I was even more confused, when I tried naming a function @test which worked in a JSFiddle, but somehow was neither correct JavaScript nor TypeScript code:

https://jsfiddle.net/2tsda7h8/

Simon Ferndriger
  • 4,455
  • 6
  • 28
  • 53
  • 1
    It's a special kind of function called a decorator, you can read about them in the typescript docs. There are class decorators, property decorators, and method decorators. – Richard Schibly Jun 07 '20 at 10:21

0 Answers0