0

I am using NGX Admin and I am stuck at reusing components. I am trying to use smart table and pie charts inside the Dashboard but I am getting a template parse error. What I did was inside dashboard.module I added the module reference

import { NgModule } from '@angular/core';    
import { NgxEchartsModule } from 'ngx-echarts';

import { ThemeModule } from '../../@theme/theme.module';
import { DashboardComponent } from './dashboard.component';
import { TablesModule } from '../tables/tables.module';


@NgModule({
  imports: [
    ThemeModule,
    NgxEchartsModule,
    TablesModule    
  ],
  declarations: [
    DashboardComponent,
  ],
})
export class DashboardModule { }

and then in the Dashboard.component I imported the table component

  import {Component, OnDestroy} from '@angular/core';
import { NbThemeService } from '@nebular/theme';
import { takeWhile } from 'rxjs/operators/takeWhile' ;
import {SmartTableComponent} from '../tables/smart-table/smart-table.component'

@Component({
  selector: 'ngx-dashboard',
  styleUrls: ['./dashboard.component.scss'],
  templateUrl: './dashboard.component.html',
})
export class DashboardComponent { }

and then finally in the html file I added the tag

<ng2-smart-table>
</ng2-smart-table>

but I am getting a template parse error. The tag is not recognized. Can someone please tell me what I am doing wrong here.

SP1
  • 1,182
  • 3
  • 22
  • 47

1 Answers1

-1

In your module.ts file add "Ng2SmartTableModule" in the imports and add tag in your component html. In your Dashboard component you just import properties of ng2-smart-table like LocalDataSource - import { LocalDataSource } from 'ng2-smart-table';- to instantiate a source and load your data in your table.