Import one library into another NX

Viewed 499

I am starting learning NX. I have created few libraries.

libs

  • ui
  • material

In material lib i have imported angular-material library :

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import {MatButtonModule} from '@angular/material/button';

@NgModule({
  imports: [
    CommonModule,
    BrowserAnimationsModule,
    MatButtonModule
  ],
  exports: [
    MatButtonModule
  ]
})
export class MaterialModule {}

In the ui-lib i imported the material like this:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TodosComponent } from './todos/todos.component';

import { MaterialModule } from '@myorg/material';

@NgModule({
  imports: [
    CommonModule,
    MaterialModule
  ],
  declarations: [TodosComponent],
  exports: [TodosComponent],
})
export class UiModule {}

And in the TodosComponent, i used like this

<button mat-raised-button color="primary">Primary</button>

But this is not rendering the Material button, display default HTML button.

But if I directly use material.module in any app directly, button is rendering properly.

Please help

0 Answers
Related