0

I am quite new to Angular 5 and I downloaded this starter template:

Angular 5 - Firebas starter template

I have a dashboard component where I want to implement a chartjs component.

My dashboard.module.ts:

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 {}

And here the dashboard.component.html template:

 <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>

Here is the linechart component:

import { Component, OnInit } from '@angular/core';
import * as Chart from 'chart.js'

@Component({
    selector: 'line-chart-component',
    templateUrl: './line-chart.component.html'
})
export class LineChartComponent {
    constructor() { }
}

And the linechart html:

    <div class="container">
      <h1>TESTCOMPONENT</h1>
    </div>

And the chart module:

import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { LineChartComponent } from './line-chart.component';

@NgModule({
    declarations: [LineChartComponent],
    // export: [LineChartComponent],
})
export class LineChartModule {}

But the export declaration is not assignable to parameter of type "NgModule"

How can I use the chart component in the dashboard component?

3
  • it's exports, not export Commented Mar 25, 2018 at 18:30
  • @marko than it throws me this error: errors: 'line-chart-component' is not a known el…, …} Commented Mar 25, 2018 at 18:38
  • The link you cite is not working Commented Mar 25, 2018 at 18:53

1 Answer 1

1

It's exports not export:

@NgModule({
    declarations: [LineChartComponent],
    exports: [LineChartComponent],
})
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.