Angular 角度5组件使用
我是Angular 5的新手,我下载了以下入门模板: 我有一个仪表板组件,我想在其中实现一个chartjs组件 My dashboard.module.ts:Angular 角度5组件使用,angular,typescript,Angular,Typescript,我是Angular 5的新手,我下载了以下入门模板: 我有一个仪表板组件,我想在其中实现一个chartjs组件 My dashboard.module.ts: import { DashboardPageComponent } from './dashboard-page.component'; import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; @NgModule(
import { DashboardPageComponent } from './dashboard-page.component';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', pathMatch: 'full', component: DashboardPageComponent },
]),
],
declarations: [DashboardPageComponent],
})
export class DashboardModule {}
这里是dashboard.component.html模板:
<div class="container">
<h1>Your Todo List</h1>
<ul class="list-group">
<p>test</p>
</ul>
// HERE I WANT TO USE THE CHART COMPONENT
<line-chart-component></line-chart-component>
</div>
以及线形图html:
<div class="container">
<h1>TESTCOMPONENT</h1>
</div>
但导出声明不可分配给NgModule类型的参数
如何使用仪表板组件中的图表组件?它是导出而不是导出:
这是出口,不是出口export@marko然后它抛出了一个错误:错误:“折线图组件”不是一个已知的el…,…}您引用的链接不起作用
<div class="container">
<h1>TESTCOMPONENT</h1>
</div>
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { LineChartComponent } from './line-chart.component';
@NgModule({
declarations: [LineChartComponent],
// export: [LineChartComponent],
})
export class LineChartModule {}
@NgModule({
declarations: [LineChartComponent],
exports: [LineChartComponent],
})