A problem occurred while compiling the 'SharedModule' template: The expression form is not compatible with the current system

In creating this share module, I have included the following components:

@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 }
      ],
    };
  }
}

When calling this in the app.module,

    SharedModule.forRoot(),

An error is displayed when running the project:

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.

To address this issue, you can try the following solutions:

Answer №1

The first comma (,) is in the wrong place.

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

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Invoke a CoffeeScript function within a jQuery function

Two files are causing me trouble: one is written in plain jQuery, and the other is a Coffeescript The jQuery file looks like this: $(document).ready(function(){ checkPrice(); }); In comparison, the CoffeeScript file appears as follows: $ -> c ...

Comparing NativeScript and Flutter

Currently diving into the world of Native Script with Angular, I am fascinated by the code sharing capabilities that allow me to work on both web and mobile applications. However, a lingering question in my mind is why Google chose to develop Angular for ...

Close session when browser/tab is exited

After extensive searching online, I have been unable to find a satisfactory solution for ending a session when a browser or tab is closed without requiring the user to log off. I have attempted numerous JavaScript codes that I came across, but none of the ...

Angular: verifying the presence of any of the ng-content slots supplied

I have a component template that contains several ng-content elements: <div class="form__general"> <ng-content select="[general]"></ng-content> </div> <div class="form__footer"> <ng-conte ...

What is the reasoning behind AngularJS 2 HTTP Post only allowing string data as input?

Can someone explain to me why the HTTP Post method in AngularJS 2 (2.0.0-beta.13) only accepts string data as body, unlike in AngularJS 1 where it can accept a JavaScript object? AngularJS-1: $http.post(someUrl,someObject) AngularJS-2: http.post(someUr ...

Creating a distinct header value for every $http request

I've been assigned the task of adding a unique ID for each request to all HTTP requests made by our AngularJS application for logging purposes. While this is more crucial for API calls, I'm currently working on implementing it for all kinds of re ...

How to retrieve the type of a computed keyof T as a generic type within TypeScript

I am working with two different interfaces: interface PersonRequirements{ user:string, password:string, id:number } export interface Requirement<R> { name: keyof R & string, save: () => any,/* I want this return type to be ...

Is there a way for me to extract the true text content that is concealed within the page source code?

Is there a way to extract the hidden text "2015-10-31" from a webpage, even though it is not visible in the page source? I am able to scrape the right side of the HTML, but I need to access the value on the left side. I have tried using Selenium to automat ...

Most effective method for integrating a JS module across all browsers

I have created a robust library that I want to integrate into a different web project. This library handles all its dependencies and consists of js, css, and html files. My ideal scenario would be to package it as an npm module and simply use import to in ...

Plugin for managing responses other than 200, 301, or 302 in forms

Currently, I am using the jQuery Form Plugin in my project. Everything works smoothly when the server sends a 200 response as it triggers the success listener seamlessly. However, according to the standard protocol, the browser automatically handles 301 ...

Exploring deep within the layers to reach a component in Angular

In the hierarchy of components, I have a parent component that contains multiple other components. Among these nested components, there is a special component that I am particularly interested in. ParentComponent SubComponent1 MySpecialCom ...

Adding a class to an element within a React template using JS is not possible

I am currently using a Bootstrap template for my React app. Within the template, there is a JavaScript code that should make the header sticky when scrolling. It functions as expected in pure HTML, but once I move the header to a React template (necessary ...

How to Implement Force Unmount in Vue 3 When Deactivated

I've developed a VUE app that makes use of the keep-alive method in the router. There are multiple pages that should only be loaded once, but certain specific pages need to be reloaded every time they are activated. <template> <router-view ...

Interacting with a C# Web Service Using JQuery

I've set up a JSON web service in C# and I'm working on creating a custom HTML page to interact with it. http://localhost:25524/DBService.svc/json/db=TestDB/query=none When I input this URL into my browser, I expect to receive JSON formatted da ...

What is the best way to implement an undo-list using arrays?

My current project involves creating a paint program in JavaScript, and I am aiming to implement an undo function rather than just an eraser. How can I store events in an array and then enable the deletion of each event individually? I have a dropdown men ...

Sending JSON data from a Django view to a JavaScript function

I am trying to pass JSON data to JavaScript. I need the JSON structure to be like this: data: [ { value: 335, name: 'Coding' }, { value: 310, name: 'Database ...

Once this code is executed, Javascript ceases to function

I have developed a code snippet to create a typing effect similar to a command console. While the code is functioning well on its own, any additional code I add after it seems to malfunction. I've spent quite some time troubleshooting this issue witho ...

Scroll bar in Highstock does not completely cover the entire length when dealing with multiple series

Having trouble with the scrollbar on a multi-series line chart where the x-axis represents dates. It seems that the maximum length of the scrollbar is determined by the length of the first, older series. When clicking the 'All' button in the ran ...

Switching Between HTML Using Javascript

I am currently working on an app that allows users to easily check the local weather and temperature in either celsius or fahrenheit. However, I've encountered a problem when trying to switch between the two unit types by simply clicking on the temper ...

A class or another interface is the only type that an interface is allowed to extend

We are currently using typescript version 2.9.2 I encountered an issue while trying to extend the interface DropDownOption. I received the error "error TS2312: An interface may only extend a class or another interface." Is there an alternate approach to ...