Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ts1206 decorators are not valid here, Angular 2

I started to program Angular 2 and I stuck with an error:

ts1206 decorators are not valid here

@Component({   //  ts1206 decorators are not valid here   selector: 'my-app',   moduleId: module.id,   templateUrl: 'app.component.html',   styleUrls: ['app.component.css'] }) 

Update:

My tsconfig.json:

 {   "compilerOptions": {     "target": "es5",     "module": "commonjs",     "moduleResolution": "node",     "sourceMap": true,     "emitDecoratorMetadata": true,     "experimentalDecorators": true,     "removeComments": false,     "noImplicitAny": true,     "suppressImplicitAnyIndexErrors": true   } } 

what can I do with it?

like image 589
Elior Sastiel Avatar asked Jul 13 '16 16:07

Elior Sastiel


1 Answers

The Decorators must come directly before an exported class for example:

@Component({     ... }) export class someComponent{} 

this goes the same for @Pipe @Directive @Injectable and @NgModule

like image 150
Jarod Moser Avatar answered Oct 02 '22 22:10

Jarod Moser