mr coder
mr coder

Reputation: 209

Error during template compile of 'SharedModule' Expression form not supported

i create this share module :

@NgModule({
  declarations: [
    , DateToPersian
    , EnumToArrayPipe
    , SearchWtihInput
    , ConvertbytePipe
    , ArraySortPipe
    , MonySplitePipe
    , IsEllipsisActiveDirective

  ],
  imports: [
    CommonModule,
    FormsModule,
    MaterialFileInputModule,
    MatDatepickerModule,
    // use this if you want to use native javascript dates and INTL API if available
    // MatNativeDatetimeModule,
    MatDatepickerModule,
    ReactiveFormsModule,
    MaterialModule,
    FormsModule,
    TranslateModule.forChild()
  ],
  providers: [LogHelper, DateService,
    { provide: DateAdapter, useClass: MaterialPersianDateAdapter, deps: [MAT_DATE_LOCALE] },
    { provide: MAT_DATE_FORMATS, useValue: PERSIAN_DATE_FORMATS }

  ],
  exports: [
    MaterialModule
    , ConvertbytePipe
    , DateToPersian
    , EnumToArrayPipe
    , SearchWtihInput
    , MonySplitePipe
    , ArraySortPipe
    , IsEllipsisActiveDirective
  ],
})
export class SharedModule {
  static forRoot(): ModuleWithProviders {
    // Forcing the whole app to use the returned providers from the AppModule only.
    return {
      ngModule: SharedModule,
      providers: [LogHelper, DateService,
        { provide: DateAdapter, useClass: MaterialPersianDateAdapter, deps: [MAT_DATE_LOCALE] },
        { provide: MAT_DATE_FORMATS, useValue: PERSIAN_DATE_FORMATS }
      ],
    };
  }
}

and i call that in the app.module like this :

    SharedModule.forRoot(),

but when i run the projct it show me this error :

ERROR in src/app/shared/shared.module.ts(22,18): Error during template compile of 'SharedModule' Expression form not supported.

src/app/shared/shared.module.ts(22,18): Error during template compile of 'SharedModule' Expression form not supported.

Cannot determine the module for class ConvertbytePipe in E:/MyProject/Ava/PFA/demo/src/app/shared/pipes/convertbyte.pipe.ts! Add ConvertbytePipe to the NgModule to fix it.

Cannot determine the module for class DateToPersian in E:/MyProject/Ava/PFA/demo/src/app/shared/pipes/date-to-persian.pipe.ts! Add DateToPersian to the NgModule to fix it.

Cannot determine the module for class EnumToArrayPipe in E:/MyProject/Ava/PFA/demo/src/app/shared/pipes/EnumToArrayPipe.ts! Add EnumToArrayPipe to the NgModule to fix it.

Cannot determine the module for class SearchWtihInput in E:/MyProject/Ava/PFA/demo/src/app/shared/pipes/saerch-with-input-pipe.ts! Add SearchWtihInput to the NgModule to fix it.

Cannot determine the module for class MonySplitePipe in E:/MyProject/Ava/PFA/demo/src/app/shared/pipes/mony-splite.pipe.ts! Add MonySplitePipe to the NgModule to fix it.

Cannot determine the module for class ArraySortPipe in E:/MyProject/Ava/PFA/demo/src/app/shared/pipes/sort-pipe.ts! Add ArraySortPipe to the NgModule to fix it.

Cannot determine the module for class IsEllipsisActiveDirective in E:/MyProject/Ava/PFA/demo/src/app/shared/directives/is-ellipsis-active.directive.ts! Add IsEllipsisActiveDirective to the NgModule to fix it.

Cannot determine the module for class PrettyShowJson in E:/MyProject/Ava/PFA/demo/src/app/shared/pipes/pretty-json.ts! Add PrettyShowJson to the NgModule to fix it.

how can i solve this problem ???????

Upvotes: 0

Views: 726

Answers (1)

Kapil Raghuwanshi
Kapil Raghuwanshi

Reputation: 877

First comma (,) is wrongly placed.

@NgModule({
  declarations: [
      DateToPersian
    , EnumToArrayPipe
    , SearchWtihInput
    , ConvertbytePipe
    , ArraySortPipe
    , MonySplitePipe
    , IsEllipsisActiveDirective]

Upvotes: 2

Related Questions