What is meaning by @ symbol in typescript --Angular 2

前端 未结 2 1974
粉色の甜心
粉色の甜心 2021-02-02 08:41

I am using typescript for angular 2 application development.

But when we write code for component or route config or some other place we use \"@\" symbol.

My que

2条回答
  •  鱼传尺愫
    2021-02-02 09:47

    This means you are applying a decorator.

    With the introduction of Classes in TypeScript and ES6, there now exist certain scenarios that require additional features to support annotating or modifying classes and class members. Decorators provide a way to add both annotations and a meta-programming syntax for class declarations and members. Decorators are a stage 1 proposal for JavaScript and are available as an experimental feature of TypeScript.

    • How to implement a typescript decorator?
    • https://www.typescriptlang.org/docs/handbook/decorators.html

提交回复
热议问题