What does the "@" char mean in ecmascript 6?

Given the script below, which can be found in the angular 2 official tutorial , what does the “@” symbol mean? Is this a feature of ecgncript 6?

Can anyone describe this?

import {Component} from 'angular2/core';
export class Hero {
  id: number;
  name: string;
}
@Component({
  selector: 'my-app',
  template:`
    <h1>{{title}}</h1>
    <h2>{{hero.name}} details!</h2>
    <div><label>id: </label>{{hero.id}}</div>
    <div>
      <label>name: </label>
      <input [(ngModel)]="hero.name" placeholder="name">
    </div>
    `
})
export class AppComponent {
  public title = 'Tour of Heroes';
  public hero: Hero = {
    id: 1,
    name: 'Windstorm'
  };
}
+4
source share
1 answer

These are just TypeScript decorators, check them out here.

Decorator . , . (, declare).

, .

, .

. , . . (@), Greeter:

@sealed
class Greeter {
    greeting: string;
    constructor(message: string) {
        this.greeting = message;
    }
    greet() {
        return "Hello, " + this.greeting;
    }
}
+1

All Articles