Wieder was gelernt

Angular Components in Module

Tags: angular devextreme
2020-09-02

To use predefined components in a module, you have to import them into the module itself, not just the app.module. Otherwise you will get an error like this:

‘dx-tree-list’ is not a known element:

  1. If ‘dx-tree-list’ is an Angular component, then verify that it is part of this module.
  2. If ‘dx-tree-list’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.

So, to keep with the example, to use dx-tree-list, you need to add DxTreeListModule to DevExtremeModule and then add DevExtremeModule to your module:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { DevExtremeModule } from  '../common/devextreme.module';
import { ReportlistComponent } from './components/reportlist/reportlist.component';
import { SurveyReportsRoutingModule } from './surveyreports-routing.module';



@NgModule({
  declarations: [ReportlistComponent],
  imports: [
    CommonModule,
    DevExtremeModule,
    SurveyReportsRoutingModule,
  ]
})
export class SurveyReportsModule { }

// vim: tw=79 sw=2 expandtab