I am looking to update my table once I have closed the modal in Angular

I am facing an issue with refreshing the table in my component using the following function:

this._empresaService.getAllEnterprisePaginated(1);
. This function is located in my service, specifically in the modal service of the enterprise component.

CODE for the enterprise component

createEnterprise() {
        this._empresaService.createNewEnterprise(this.imagenSubir, this.enterprise_name)
        .then((resp: any) => {
            resp = JSON.parse(resp);
            if(resp.out == 1) {
                this.toastr.error('La empresa ' + this.enterprise_name + ' ya se encuentra registrada en el sistema', 'Error!', {
                    positionClass: 'toast-bottom-left',
                    progressBar: true
                });
                return;
            } else {
                this.toastr.success('La empresa ' + this.enterprise_name + ' fue creada exitosamente', 'Empresa creada!', {
                    positionClass: 'toast-bottom-left',
                    progressBar: true
                });
                this.cerrarModal();
                // this._empresaService.getAllEnterprisePaginated(1);
                // for (let i = 0; i < this._empresaService.allEnterprise.length; i++) {
                //  var emp : Enterprise = this._empresaService.allEnterprise[i]

                // }
            }
        });

    }

CODE for the ENTERPIRSE MODAL SERVICE

getAllEnterprisePaginated(init_page: any = 1) {
        let page = {init_page: init_page}
        let url = URL_SERVICIOS + '/getallenterprise';
        return this.http.post(url, page)
        .pipe(map((resp: any) => {
            this.allEnterprise = resp.recordset
            return resp;    
        }));
    }

The function I added is not functioning as expected.

Answer №1

corporate module

this._companyService.getAllCompanyItems(1).subscribe(response =>{
for (let i = 0; i < response; i++) {
       var comp : Company = response[i];
   }
})

There is no data coming from this._companyService.allCompany console.log(this._companyService.allCompany);

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

The ng2-intl encounters an issue when trying to resolve symbol values statically

I'm struggling with a common issue and can't seem to find a solution that works. My setup involves Angular 4.2.6 along with ng2-intl 2.0.0-rc.3. Despite trying the following code, I am still facing issues: export function intlFactory(http:Http ...

Allow only numerical values through an ion-input in Ionic 4, preventing the input of letters and special characters

I am currently developing an application in Ionic 4 that requires users to enter only integer numbers (0-9). I need to prevent any other characters such as alphabets, dots, or plus signs from being entered. However, the methods I have tried so far have not ...

Resolving issues with Typescript declarations for React Component

Currently utilizing React 16.4.1 and Typescript 2.9.2, I am attempting to use the reaptcha library from here. The library is imported like so: import * as Reaptcha from 'reaptcha'; Since there are no type definitions provided, building results ...

Make sure to verify the optional parameter before using it in your code

Is it possible for TypeScript compiler to detect errors in code such as this, with certain tsconfig rules in place? function buildName(firstName: string, lastName?: string) { return firstName + " " + lastName; } I believe that if there is no c ...

Angular 6 Checkbox Selector - Filtering Made Easy

How can I filter a list of JSON objects (Products) by the 'category' variable using checkboxes? An example product object is shown below: { 'bikeId': 6, 'bikeName': 'Kids blue bike', 'bikeCode': ...

Error message in Vue3 with TypeScript: When using global components, you may encounter the error "JSX element type '___' does not have any construct or call signatures.ts(2604)."

Each globally registered component suddenly displays a red TypeScript squiggle in the markup! Surprisingly, the app continues to function without any visible errors! This issue arises with all components, whether they are custom-made or third-party libr ...

Is it possible to retrieve a value obtained through Request.Form?

Within my Frontend, I am passing an Object with a PersonId and a FormData object. const formData = new FormData(); for (let file of files){ formData.append(file.name, file,); } formData.append('currentId',this.UserId.toString()); const upl ...

Angular Igx-calendar User Interface Component

I need assistance with implementing a form that includes a calendar for users to select specific dates. Below is the code snippet: Here is the HTML component file (about.component.html): <form [formGroup]="angForm" class="form-element"> <d ...

The properties in Typescript, specifically 'value', are not compatible with each other

I've encountered an error while working on a TypeScript project with React Context. The error message states: Argument of type 'Context<{}>' is not assignable to parameter of type 'Context<IsProductContext>'. The type ...

Is there a way for a dialog to prompt a Parent Window to refresh its grid?

My Angular Material Grid has an Edit option that opens a form using mat-dialog when clicked. Upon trying to close the form, another dialog prompts the user to save the changes made. If the user chooses to save, the data is sent to the backend via API and b ...

Is it feasible to transmit telemetry through a Web API when utilizing ApplicationInsights-JS from a client with no internet connectivity?

My Angular application is running on clients without internet access. As a result, no telemetry is being sent to Azure. :( I am wondering if there is a way to configure ApplicationInsights-JS to call my .Net Core WebApi, which can then forward the inform ...

What steps can I take to resolve the issue with the cdk module?

click here for image This persistent error keeps appearing whenever I try to resize the window. I was hoping that when I decrease the page size, the search bar would transform into an icon with a dropdown search function. Despite my attempts to modify the ...

I am experiencing issues with arrow pagination not functioning properly in TypeScript

My current project involves building a customer table with 10 customers displayed on each page. Additionally, there are arrows below the table to help users navigate and view more customers. Unfortunately, there seems to be an issue with the functionality ...

What are some ways to utilize TypeScript in incorporating extensions to `koa.Request` packages?

Struggling to utilize both koa-tree-router and koa-bodyparser simultaneously, encountering persistent TypeScript errors: export const userLoggingRouter = new KoaTreeRouter<any, DefaultContext>(); userLoggingRouter.post('/logs/action', (ctx ...

Error message in Angular2 beta 11: "Cannot access property zone from undefined"

I've been attempting to integrate browser-sync into my gulp pipeline for development purposes, but despite following the setup steps in my gulpfile, I can't seem to get the automatic reload function to work. When I run gulp start, a browser tab o ...

Intellij IDEA does not offer auto-completion for TypeScript .d.ts definitions when a function with a callback parameter is used

I've been working on setting up .d.ts definitions for a JavaScript project in order to enable auto-completion in Intellij IDEA. Here is an example of the JavaScript code I'm currently defining: var testObj = { tests: function (it) { ...

Can we store an API response in cache to access the API without an internet connection?

Is there a way to cache the master date API so that even when offline, the response can still be accessed? ...

Angular Proxy is not passing the WebSocket Upgrade Header

When using the Angular CLI proxy by running ng serve --proxy-config proxy.conf.json the configuration looks like this: { "/api/*": { "ws": true, "secure": false, "target": "http://localhost:80", "logLevel": "debug" ...

Using Symbol.iterator in Typescript: A step-by-step guide

I have decided to upgrade my old React JavaScript app to React Typescript. While trying to reuse some code that worked perfectly fine in the old app, I encountered errors in TS - this is also my first time using TS. The data type I am exporting is as foll ...

Encountered an issue while trying to install the package '@angular/cli'

Encountered errors while attempting to install @angular/cli using npm install -g @angular/cli. The node and npm versions on my system are as follows: C:\WINDOWS\system32>node -v v 12.4.0 C:\WINDOWS\system32>npm -v 'C ...