I have a uiModule. It imports and exports various @angular/material modules.
I had hoped that when I import uiModule in to anotherModule; now anotherModule will have access to @angular/material stuff... But that is not exactly working.
While material works fine inside the uiModule — anotherModule recognizes material elements however there are a lot of errors like
NullInjectorError: No provider for InjectionToken mat-menu-scroll-strategy!
NullInjectorError: No provider for Overlay!
I got those examples after trying to use <mat-menu>
Here is a look at the uiModule
// material
import { MatExpansionModule } from '@angular/material/expansion';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatChipsModule } from '@angular/material/chips';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatMenuModule } from '@angular/material/menu';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';
import { MatIconModule } from '@angular/material/icon';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatDialogModule } from '@angular/material/dialog';
const material = [
MatIconModule,
MatProgressSpinnerModule,
MatProgressBarModule,
MatExpansionModule,
MatInputModule,
MatChipsModule,
MatAutocompleteModule,
MatFormFieldModule,
MatDatepickerModule,
MatNativeDateModule,
MatMenuModule,
OverlayModule,
MatDialogModule,
ScrollingModule,
];
@NgModule({
declarations: [
PaginationComponent,
],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
...material,
],
providers: [],
exports: [
PaginationComponent,
...material,
],
})