无法绑定到'',因为它不是已知属性''angular 2
问题描述:
我在Angular 2项目中遇到异常,并且不明白为什么。无法绑定到'',因为它不是已知属性''angular 2
这是我的代码:
TS:
import {Component} from "@angular/core";
import {GridOptions} from "ag-grid";
import {RedComponentComponent} from "../red-component/red-component.component";
@Component({
selector: 'app-my-grid-application',
templateUrl: './my-grid-application.component.html'
})
export class MyGridApplicationComponent {
public gridOptions: GridOptions;
constructor() {
this.gridOptions = {};
this.gridOptions.columnDefs = [
{
headerName: "ID",
field: "id",
width: 100
},
{
headerName: "Value",
field: "value",
cellRendererFramework: RedComponentComponent,
width: 100
},
];
this.gridOptions.rowData = [
{id: 5, value: 10},
{id: 10, value: 15},
{id: 15, value: 20}
]
}
}
HTML:
<div style="width: 200px;">
<app-my-grid-application #agGrid style="width: 100%; height: 200px;" class="ag-fresh"
[gridOptions]="gridOptions">
</app-my-grid-application>
</div>
错误:
Can't bind to 'gridOptions' since it isn't a known property of 'app-my-grid-application'.
任何帮助将深刻地感谢!
@ R.Richards控制台,在运行时。这就是我使用“例外”这个词的原因。 – Alon