V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NullMan
V2EX  ›  Angular

Angular2 的 @符号究竟是啥意思?

  •  
  •   NullMan · 2017-03-22 16:35:06 +08:00 · 3519 次点击
    这是一个创建于 2584 天前的主题,其中的信息可能已经有所发展或是发生改变。
    import { Component } from '@angular/core';
    
    @Component({
      selector: 'my-app',
      template: `<h1>Hello {{name}}</h1>`
    })
    export class AppComponent { name = 'Angular'; }
    

    这里的“@Component ”的“@”是啥意思?相关知识来由能在哪里看到呢?还有就是“@angular/core ”的“@”又是个啥意思呢?为什么不是"angular/core"? 斜线“/”又是怎么做到的?

    还望大家赐教赐教。给出相关知识链接即可。

    4 条回复    2017-03-22 17:17:21 +08:00
    xialdj
        2
    xialdj  
       2017-03-22 16:44:13 +08:00 via iPhone
    这个是 decorator 语法 本来纳入 es6 标准的 后来延到 es7 结果到现在还没加入标准 可能 es2018 或者 2019 ?
    xialdj
        3
    xialdj  
       2017-03-22 16:45:02 +08:00 via iPhone
    @angular/core 这个只是单纯的名字而已
    aristotll
        4
    aristotll  
       2017-03-22 17:17:21 +08:00
    es6 的语法 类似 Python 的装饰器?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1126 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:37 · PVG 02:37 · LAX 11:37 · JFK 14:37
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.