我有一个table-basic.component.ts,其中我声明了表格基本'作为一个选择器,我在dashboard.html中调用模板,我按照下面的过程,但我仍然有一个错误,我也在下面提到。
我的dashboard.template.html,
<div href='#tab2'>
<div id='tab2'>
<tables-basic></tables-basic>
</div>
</div>
我的,
import { Component, ViewEncapsulation } from '@angular/core';
import { TablesBasic } from '../tables/basic/tables-basic.component';
import { AppConfig } from '../app.config';
@Component({
selector: 'dashboard',
templateUrl: './dashboard.template.html'
})
export class Dashboard {
config: any;
month: any;
year: any;
}
错误,
main.browser.ts:25Error: Template parse errors:(…)(anonymous function) @ main.browser.ts:25ZoneDelegate.invoke
@ zone.js:203Zone.run
@ zone.js:96(anonymous function)
@ zone.js:462ZoneDelegate.invokeTask
@ zone.js:236Zone.runTask
@ zone.js:136drainMicroTaskQueue
@ zone.js:368ZoneTask.invoke
@ zone.js:308
我不知道这个错误,任何人都可以提出帮助。
答案 0 :(得分:1)
您需要将TableBasicComponent
添加到父组件模块的声明中。
import { TableBasicComponent } from 'path/to/component'
@NgModule({
declarations: [
TableBasicComponent // < --- added here
],
imports: [
],
providers: []
})
export class DashboardModule { }