DEV Community

mkris2003
mkris2003

Posted on

I am declaring material components as separate module. Error Value could not be determined staticall in angular 12

Error 1.
Value at position 15 in the NgModule.imports of MaterialModule is not a reference
Value could not be determined statically.(-991010)
const MaterialComponents: (typeof MatButtonToggleModule)[]

Error 2:
Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

Is it missing an @NgModule annotation?(-996002)
class MaterialModule

import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import {MatButtonModule} from '@angular/material/button';
import {MatButtonToggleModule} from '@angular/material/button-toggle';
import {MatIconModule} from '@angular/material/icon';
import {MatBadgeModule} from '@angular/material/badge';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import {MatToolbarModule} from '@angular/material/toolbar';
import {MatSidenavModule} from '@angular/material/sidenav';
import {MatMenuModule} from '@angular/material/menu';
import {MatListModule} from '@angular/material/list';
import {MatDividerModule} from '@angular/material/divider';
import {MatGridListModule} from '@angular/material/grid-list';
import {MatExpansionModule} from '@angular/material/expansion';
import {MatCardModule} from '@angular/material/card';
import {MatTabsModule} from '@angular/material/tabs';
import {MatStepperModule} from '@angular/material/stepper';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatInputModule} from '@angular/material/input';
import {MatSelectModule} from '@angular/material/select';
import {MatAutocompleteModule} from '@angular/material/autocomplete';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatRadioModule} from '@angular/material/radio';
import {MatDatepickerModule} from '@angular/material/datepicker';
import {MatNativeDateModule} from '@angular/material/core';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatSnackBarModule} from '@angular/material/snack-bar';
import {MatDialogModule} from '@angular/material/dialog';
import {MatTableModule} from '@angular/material/table';
import {MatPaginatorModule} from '@angular/material/paginator';
import {MatSortModule} from '@angular/material/sort';
import { ScrollingModule } from '@angular/cdk/scrolling';

const MaterialComponents=
[MatButtonModule, MatButtonToggleModule, MatIconModule, MatBadgeModule,
MatProgressSpinnerModule, MatToolbarModule, MatSidenavModule, FormsModule, ReactiveFormsModule,
MatMenuModule, MatListModule, MatDividerModule, MatGridListModule, MatExpansionModule,
MatCardModule, MatTabsModule, MatStepperModule, MatFormFieldModule, MatInputModule,
MatSelectModule, MatAutocompleteModule, MatCheckboxModule, MatRadioModule, MatDatepickerModule,
MatNativeDateModule, MatTooltipModule, MatSnackBarModule, MatDialogModule,
MatTableModule, MatPaginatorModule, MatSortModule, ScrollingModule
];

@NgModule( {
imports: [MaterialComponents],
exports:[
MaterialComponents
]
})
export class MaterialModule { }

Top comments (1)

Collapse
 
mkris2003 profile image
mkris2003

Hi All,
I resolved the issue, issue is module names changes in material 12 Version.

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {MatTabsModule} from '@angular/material/tabs';
import {MatSidenavModule} from '@angular/material/sidenav';
import {MatToolbarModule} from '@angular/material/toolbar';
import {MatIconModule} from '@angular/material/icon';
import {MatButtonModule} from '@angular/material/button';
import {MatListModule} from '@angular/material/list';
import {MatMenuModule} from '@angular/material/menu';
import {MatTableModule} from '@angular/material/table';
import {MatSortModule} from '@angular/material/sort';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatInputModule} from '@angular/material/input';
import {MatPaginatorModule} from '@angular/material/paginator';

@NgModule({
declarations: [

],
Enter fullscreen mode Exit fullscreen mode

imports: [
CommonModule,
MatTabsModule,
MatSidenavModule,
MatToolbarModule,
MatIconModule,
MatButtonModule,
MatListModule,
MatMenuModule,
MatTableModule,
MatSortModule,
MatFormFieldModule,
MatInputModule,
MatPaginatorModule
],

exports: [
CommonModule,
MatTabsModule,
MatSidenavModule,
MatToolbarModule,
MatIconModule,
MatButtonModule,
MatListModule,
MatMenuModule,
MatTableModule,
MatSortModule,
MatFormFieldModule,
MatInputModule,
MatPaginatorModule
]
})
export class MaterialModule { }