Angular2版本RC.6“directives”里面的@Component错误

我使用Angular2,并从官方网站下载了package.json。当我试图在@Component装饰器中使用“指令”时,我收到这个错误

我附上我的代码错误

[ts]
Argument of type '{ selector: string; template: string; directives: string; 
}' is not assignable to parameter of type 'ComponentMetadataType'.

Object literal may only specific kNown properties,and 'directives' does not
exist in type 'ComponentMetadataType'.
(property) directives: string

这是我的代码

import { Component } from '@angular/core';
import { PeopleListComponent } from './people-list/people-list.component';

@Component({
 selector: 'my-app',template: '<h1>{{ title }}</h1>',directives: ''   //ERROR //NOT ABLE TO RECOGNIZE
})

export class AppComponent { 
  title = "My title";
}

这是我的package.json:

{
          "name": "angular2-quickstart","version": "1.0.0","scripts": {
            "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ","lite": "lite-server","postinstall": "typings install","tsc": "tsc","tsc:w": "tsc -w","typings": "typings"
          },"license": "ISC","dependencies": {
            "@angular/common": "2.0.0-rc.6","@angular/compiler": "2.0.0-rc.6","@angular/compiler-cli": "0.6.0","@angular/core": "2.0.0-rc.6","@angular/forms": "2.0.0-rc.6","@angular/http": "2.0.0-rc.6","@angular/platform-browser": "2.0.0-rc.6","@angular/platform-browser-dynamic": "2.0.0-rc.6","@angular/router": "3.0.0-rc.2","@angular/upgrade": "2.0.0-rc.6","core-js": "^2.4.1","reflect-Metadata": "^0.1.3","rxjs": "5.0.0-beta.11","systemjs": "0.19.27","zone.js": "^0.6.17","angular2-in-memory-web-api": "0.0.18","bootstrap": "^3.3.6"
          },"devDependencies": {
            "concurrently": "^2.2.0","lite-server": "^2.2.2","typescript": "^1.8.10","typings":"^1.3.2"
          }
        }
简单…

问题在于指令:”

作为它的一个数组应该是指令:[]

更新:在RC6或更高版本中,您有@NgModule。在RC6或更高版本中,您必须声明您将在@NgModule中使用的管道和指令,如图所示

import { PeopleListComponent } from './people-list/people-list.component';

@NgModule({
  imports:      [ browserModule],declarations: [ AppComponent,PeopleListComponent ],//<<===here
  providers:    [],bootstrap:    [ AppComponent ]
})

您可以从AppComponent的@Component中删除指令:”

相关文章

ANGULAR.JS:NG-SELECTANDNG-OPTIONSPS:其实看英文文档比看中...
AngularJS中使用Chart.js制折线图与饼图实例  Chart.js 是...
IE浏览器兼容性后续前言 继续尝试解决IE浏览器兼容性问题,...
Angular实现下拉菜单多选写这篇文章时,引用文章地址如下:h...
在AngularJS应用中集成科大讯飞语音输入功能前言 根据项目...
Angular数据更新不及时问题探讨前言 在修复控制角标正确变...