Topic: custom module - directive not found

eli@quickode.com free asked 6 years ago


I\\\'m trying to use any directive from  module (not the app.module) and I always got an error that the directive is not found.This is a sample module import { BrowserModule } from \\\'@angular/platform-browser\\\'; import { BrowserAnimationsModule } from \\\'@angular/platform-browser/animations\\\'; import { NgModule } from \\\'@angular/core\\\'; import { TeComponent } from \\\'./te.component\\\'; import { MDBBootstrapModule } from \\\'../../typescripts/free\\\'; @NgModule({ declarations: [TeComponent], imports: [ BrowserModule, BrowserAnimationsModule, MDBBootstrapModule ] }) export class TeModule { } and a sample component <button class=\\\"btn btn-primary waves-light\\\" type=\\\"button\\\" (click)=\\\"test1.toggle()\\\" mdbRippleRadius> Toggle collapse </button> <mdbCollapse #test1> <p>Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.</p> </mdbCollapse> if i move the code from the custom component to the app component it works fine. but the app is modular and has a lot of custom modules.

Edyta Dabrowska free answered 6 years ago


Hi, First of all please add NO_ERRORS_SCHEMA to your 'te' module. Like this: import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; And then here: @NgModule({ declarations: [TeComponent], imports: [ BrowserModule, BrowserAnimationsModule, MDBBootstrapModule ], schemas: [NO_ERRORS_SCHEMA] }) Second thing, I'm only guessing that you have created a new project. And I see there is missing typescripts folder from your app folder. Please copy paste it from your bought MDB Angular package. Let me know if it works now.

eli@quickode.com free answered 6 years ago


Hi I uploaded a test application https://drive.google.com/open?id=0B1VaLhbO5IQCVHlHRWFMUkFEdkk you can see that the "te" component can't use any mdb directive. Thanks

Magdalena Obalska free answered 6 years ago


Hi, could you tell in more details what's your aim?

eli@quickode.com free commented 6 years ago

Hi I uploaded a test application https://drive.google.com/open?id=0B1VaLhbO5IQCVHlHRWFMUkFEdkk you can see that the “te” component can’t use any mdb directive. Thanks


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags