Angular has surpassed the maximum call stack size, resulting in a Range Error

I am facing an issue while trying to include machine detail and a button bar in my app. Interestingly, this setup has worked perfectly fine in other parts of the application but is causing errors in the core module.

Here is the error message

main.ts

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.error(err));

Core Module (error occurs when adding "IfaButtonModule" or "MachineModule")

@NgModule({
  declarations: [
    TakePhotoComponent,
    ConfirmationDialogComponent,
    ShareMachineComponent,
    NotificationsComponent,
  ],
  imports: [
    CommonModule,
    WebcamModule,
    MatButtonModule,
    TranslateModule,
    MatDialogModule,
    MatFormFieldModule,
    MatInputModule,
    ReactiveFormsModule,
    MatIconModule,
    MatExpansionModule,
    MatBadgeModule,
    MatCardModule,
    MatMenuModule,
    IfaButtonModule,
    MachineModule
  ],
  exports: [
    TakePhotoComponent,
    ConfirmationDialogComponent,
    ShareMachineComponent,
    NotificationsComponent
  ],
  providers: [NgxImageCompressService]
})
export class CoreModule { }

Button-Module

@NgModule({
  declarations: [
    IfaButtonBarItemComponent,
    IfaButtonBarComponent,
    IfaButtonBarGroupComponent
  ],
  imports: [
    CommonModule,
    CoreModule,
    MatButtonModule,
    TranslateModule
  ],
  exports: [
    IfaButtonBarComponent,
    IfaButtonBarGroupComponent,
    IfaButtonBarItemComponent
  ]
})
export class IfaButtonModule { }

Machine Module

@NgModule({
  declarations: [
    MachineListComponent,
    MachineDetailEditComponent,
    MachineDetailComponent,
    MachineListItemComponent
  ],
  imports: [
    CommonModule,
    CoreModule,
    MatCardModule,
    MatMenuModule,
    MatListModule,
    MatButtonModule,
    FormsModule,
    ReactiveFormsModule,
    NgxPaginationModule,
    MatFormFieldModule,
    MatInputModule,
    TranslateModule,
    MatDialogModule,
    MatExpansionModule,
    IfaButtonModule,
    OperationModeModule,
    ProtectionModule,
    ManipulationModule
  ],
  exports: [
    MatMenuModule,
    MachineDetailEditComponent,
    MachineListComponent,
    MachineDetailComponent
  ]
})
export class MachineModule {

}

The HTML snippet utilizing these components (within the Core Module section):

<ng-container>
  <app-machine-detail [machine]="completeMachine">
  </app-machine-detail>
  <app-ifa-button-bar-group>
    <app-ifa-button-bar-item [label]="'MISC.BACK'" (click)="navigateBack()">
    </app-ifa-button-bar-item>
  </app-ifa-button-bar-group>
</ng-container>

Answer №1

The issue is likely occurring due to importing CoreModule in the MachineModule and vice versa, causing a circular dependency. It's crucial to reevaluate your module dependencies and resolve the circular import problem. The IfaButtonModule also encounters the same predicament.

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

Seeking guidance on capturing the correct error message when using JSON stringify?

Imagine I have an object structured as follows var obj = { "name": "arun" age } After attempting JSON.stringify(obj), it results in an error due to the improper structure of the obj. I am interested in capturing this error displayed in the console and pr ...

A guide on loading modules dynamically using React and Typescript from a server

I am working on a React / Typescript / Webpack / React-Router application that contains some large JS modules. Currently, I have two bundles (common.js and app.js) included on every page, with common.js being a CommonsChunkPlugin bundle. However, there is ...

How to dynamically add table rows and cells with JavaScript using a single selection input

I am working on a project that involves a selection input with around 5 options. Additionally, there is an empty table that follows this format: <table> <tr> <td>X (for deletion)</td> <td>Option name</td> ...

Deciphering Files with NodeJs AES Encryption and Redirecting to a Stream

I am currently working on encrypting a file in C# and decrypting it in Node.js using AES encryption. The code snippet below demonstrates the successful decryption process, however, it writes the decrypted content to an output file named `output_dec.xml&apo ...

Unable to store the data retrieved from MySQL into an array

Every time I try to add the object result1 to the array a, it ends up empty. Can someone help me figure out what I'm doing wrong? app.get('/freezer', (req, res) => { var a = []; var sql = `SELECT freezer_id FROM freezer_data`; ...

A guide on integrating Pug templating engine with ReactJS

For the integration of Pug with a freshly created ReactJS application, I followed these steps: 1. Started by creating a new ReactJS app using create-react-app 2. Next, I referred to the instructions on babel-plugin-transform-react-pug for installing the ...

"Deactivate the escaping feature in PHP when using heredoc syntax

My PHP code generates minified JS output using the heredoc. Take a look at this snippet: function prerefresh(){$("#len").empty();predata.forEach(item)} I've highlighted that the {$ is causing issues with variable escaping in my heredoc. Is there a ...

Using Javascript to retrieve the selected value from a dropdown menu does not return any results

Struggling to retrieve the selected value from a drop-down list using JavaScript? Even when an item is chosen, do you keep getting 'null' as the result? Let's take a look at the HTML page: <select class="mySelect"> <option val ...

organizing strings in alphabetical order using TypeScript

My md-collection is set up to display a list of emails like this: <md-collection-item repeat.for="u of user" class="accent-text"> <div class="row"> <di ...

Waiting for an Element to Become Visible in Selenium-Webdriver Using Javascript

When using selenium-webdriver (api docs here), how can you ensure that an element is visible before proceeding? Within a set of custom testing helpers, there are two functions provided. The first function successfully waits for an element to exist, howeve ...

Developing a pop-up feature that triggers upon clicking for a miniature rich text editing

Looking to integrate the Tiny rich text editor into my code. Check out the TextEditor.js component below: import React from 'react'; import { Editor } from '@tinymce/tinymce-react'; class App extends React.Component { handleEditorCha ...

The function is missing from the object, leading to a script error with jQuery

When using different versions of jQuery, I encountered some issues with saving changes in my application. Initially, with jquery-1.4.4.min.js, everything worked except for the save function due to an error I made. However, when switching to jquery-1.7.1.mi ...

Is there a way to remove information with react and axios?

While working on a project, I encountered an issue with using .map() to create a list. When I console log the user._id on my backend, it displays all the ids instead of just the one I want to use for deleting individual posts by clicking a button. Each pos ...

The return value depends on the type of function argument passed

I am currently developing a type-safe JSON:API specification parser for handling API responses that can either contain a single object or an array of objects (). For example, when making a request like GET /article: { data: { type: 'article&ap ...

What is the best way to retrieve user data for showcasing in a post feed using firebase's storage capabilities?

I'm currently developing a forum-style platform where users can share content that will appear on a universal feed. I intend to include user details in the posts (such as photoURL and displayName) similar to how it is done on Twitter. For this projec ...

The expected functionality of setTimeout is not being achieved

I have implemented an ajax scroll down feature in my application to load user posts. However, I am facing an issue where the for loop iteration is causing excessive loading time, leading to browser freezing until the results are displayed. To address this ...

What is the method for extracting user input from a text box on a webpage?

Having trouble with retrieving the value from a text box in my search function. SearchBar Component import { Component, OnInit, Input } from '@angular/core'; @Component({ selector: 'app-search', templateUrl: './search.compon ...

Attempting to convert the code from react documentation into class components within a react-create-app, but encountering unexpected behavior

Hey there! I'm currently diving into the world of React and challenging myself by rewriting all the code samples from the documentation in a local react-create-app. However, I've hit a roadblock with this section on the Doc, you can find the code ...

Utilizing user input in API calls: A step-by-step guide

There is an input field where you can enter a city name to get the weather data for that specific city. Currently, I am using Angular 9 and able to display weather data for London only. // Updated Weather Components import {Component, OnInit} from ' ...

Activate jQuery after a vanilla JavaScript function has been executed

I have created a jQuery function that captures any changes made to an input field and stores them in a variable. The input field is connected to a vanilla JavaScript based API library, which I am unable to convert to jQuery. This library is for an address ...