What is the @ in @ component?

import {component} from "@angular/core";
@component({})

syntactically, component should be a function, so what effect does the previous @ have on this function? I"d like to explain it from the perspective of js or ts syntax. Don"t say it"s an annotation or decorator, don"t give such a vague explanation.

Jul.11,2021

is just the decorator syntax , nothing special, there is no need to delve into the fact that this grammatical style is also accepted by ES7, so in a sense both TypeScript and JavaScript express the same thing.

in fact, the concept of annotations comes from AtScript brought by the Traceur transcoder. The decorator is from TypeScript. However, although there are some differences between the two after the compiled results, there is no difference in the actual use of the vast majority of them.

just syntax
just syntax
just syntax

Don't wrestle with syntax
Don't wrestle with syntax
Don't wrestle with syntax

Menu