2016-07-13 13 views
24

tôi bắt đầu chương trình kiễu góc 2 và tôi bị mắc kẹt với một lỗi:trang trí ts1206 không có giá trị ở đây, góc 2

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'] 
}) 

Cập nhật:

tsconfig.json của tôi:

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

tôi có thể làm gì với ứng dụng này?

+1

'cái @Component() 'phải được trực tiếp trước một lớp học, làm bạn có một lớp xuất khẩu ngay bên dưới trang trí đó? –

+0

có gì trong 'tsconfig.json' của bạn? –

+0

Tham khảo bài viết bắt đầu nhanh - https://angular.io/docs/ts/latest/quickstart.html – Sanket

Trả lời

50

Các trang trí phải đến trực tiếp trước một lớp xuất khẩu ví dụ:

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

này đi cùng cho @Pipe@Directive@Injectable

Các vấn đề liên quan