Eli*_*iel 47 typescript angular
我开始编写Angular 2,我遇到了一个错误:
ts1206装饰器在这里无效
@Component({ // ts1206 decorators are not valid here
selector: 'my-app',
moduleId: module.id,
templateUrl: 'app.component.html',
styleUrls: ['app.component.css']
})
Run Code Online (Sandbox Code Playgroud)
更新:
我的tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
Jar*_*ser 113
装饰器必须直接出现在导出的类之前,例如:
@Component({
...
})
export class someComponent{}
Run Code Online (Sandbox Code Playgroud)
这对于@Pipe @Directive @Injectable和@NgModule
| 归档时间: |
|
| 查看次数: |
38114 次 |
| 最近记录: |