Angular 2最终版本:找不到名称' PatternDetails'

时间:2016-09-20 10:02:41

标签: angular typescript webpack

我收到的错误是' PatternList' (找不到我创建的界面)。如果我尝试导入它,我会收到PatternDetails不是模块的错误。我不确定导致此错误的原因。我在我的angular2项目中尝试配置Webpack时遇到了这个错误。

这是我使用PatternDetails接口的一个组件:

@Component({
  selector: 'pattern-detail',
  template: `
    <div class="pattern-detail" [ngClass]='{active: metadata.status.backendValidationStatus == "FAIL",
      unactive: metadata.status.backendValidationStatus == "OK",
      warning: metadata.status.backendValidationStatus == "WARN",
      selected: metadata.selected
    }' (click)="patternClicked(metadata)">
      <div class="name-details">
        <h3>{{metadata.displayName}}</h3>
        <p>{{metadata.details}}</p>
      </div>
      <div class="time-details">
        <p class='last_update'>{{metadata.lastupdate}}</p>
      </div>
    </div>
  `,
  styleUrls: ['/css/pattern_detail.css']
})
export class PatternDetailComponent {

  @Input() metadata:PatternDetails;
  @Output() selectPattern = new EventEmitter<PatternDetails>();

  patternClicked(pattern: PatternDetails) {
    this.selectPattern.emit(pattern);
  }

}

这是PatternDetails接口:

interface PatternDetails {
  patternClass: string;
  version: string;
  id: string;
  displayName: string;
  lastupdate: string;
  details: string;
  status: Status;
  selected: boolean;
}

我不确定我还应该包含哪些内容,但经过我的调查后发现tsconfig.json可能存在问题,所以我也将其包含在内:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "typeRoots": [
      "../node_modules/@types"
    ]
  },
  "types" : [
    "core-js"
  ],
  "exclude": [
    "node_modules"
  ]
}

app.module.ts

@NgModule({
  imports: [ BrowserModule, FormsModule, HttpModule, ReactiveFormsModule ],
  declarations: [ AppComponent, PatternListComponent, PatternDetailComponent, WidgetListComponent,
    FormComponent, DefaultWidget, LabelComponent, CheckboxWidget ],
  bootstrap: [ AppComponent ],
  providers: [ WidgetService ]
})
export class AppModule { }

1 个答案:

答案 0 :(得分:1)

您需要导出界面:

header('Authorization: Token '.sha1("test123"));
var_dump(apache_request_headers());
exit;