Enhancing view with Typescript progressions

My current view only displays a loader.gif and a message to the user. I am looking to enhance the user experience by adding a progress indicator, such as "Processing 1 of 50", during the data update process. The ts class interacts with a data service layer responsible for updating the database, and I want to provide real-time feedback to the UI at regular intervals.

View

<div class="modal-body" *ngIf="updateVersionItemsInProgress">
   <div *ngIf="updateVersionItemsInProgress">
      <img src="/Content/images/ajax-loader.gif" /><span>Updating templates...</span>
   </div>
   <label class="col-sm-3 control-label">
      Processing {{currentitem}} of {{items.length}}
   </label>
</div>

ts file

private updateItems() {
  let versionKeys = this.items.map(i => i.VersionKey);
  this.updateVersionItemsInProgress = true;
        
  this.templatesManagementService.updateToNewVersion(versionKeys)
}

Answer №1

If your data service layer is configured a certain way, you have the option to utilize the reportProgress: true flag in order to receive feedback on the progress of your operation. For more information on this, refer to this Stack Overflow post. Keep in mind that while this method provides progress updates, it does not offer detailed record counts.

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

When running the command `npm audit fix --force`, an error is triggered stating that the data path ".builders['app-shell']" must contain the mandatory property 'class'

After installing a package, I received the following message: added 1 package from 8 contributors and audited 49729 packages in 23.754s found 25 vulnerabilities (1 low, 24 high) run `npm audit fix` to fix them, or `npm audit` for details I proceeded to ...

Angular: Unable to locate route declaration in the specified path /src/app/app-routing.module.ts

Whenever I attempt to set up automatic routing for components that have been created using the command below ng generate module orders --route orders --module app.module I encounter the following error message The requested URL /src/app/app-routing.mod ...

Using Typescript to retrieve the Return Type of a function when called with specific Parameter types

My goal is to create 2 interfaces for accessing the database: dao can be used by both admins and regular users, so each function needs an isAdmin:boolean parameter (e.g. updateUser(isAdmin: boolean, returnUser)) daoAsAdmin, on the other hand, allows metho ...

What is the recommended return type in Typescript for a component that returns a Material-UI TableContainer?

My component is generating a Material-UI Table wrapped inside a TableContainer const DataReleaseChart = (): React.FC<?> => { return ( <TableContainer sx={{ display: 'grid', rowGap: 7, }} > ...

AngularFireFunctions httpCallable doesn't reflect updated data post-response

Despite successfully receiving a value from an Observable using AngularFireFunctions' httpsCallable, the view fails to update even after the http request is completed. In my simple component, I utilize AngularFireFunctions to invoke an httpCallable f ...

When utilizing a [ngSwitch] with the toolbar (md-toolbar) in Angular2, the buttons fail to load correctly

I am currently designing a toolbar that includes a menu button using the following code: <md-toolbar class="header"> <div class="header-wrapper m-x-30 clearfix"> <div class="logo-container"> <div class="logo-image align-middle" ...

Displaying sorted objects from Angular serviceIn Angular 8, let's retrieve an object

In my Angular8 application, I am running a query that fetches a data object. My goal is to sort this data object based on the order value and then display each product item on the browser. For example, here is an example of how the output should look like ...

Lazy loading a child component in Angular 8: A step-by-step guide

In my project, I have a complex component that consists of multiple modals (NgbModal). These modals are connected to various child components. My goal is to implement lazy loading for these child components. Dashboard Module | |--> Dashboa ...

Managing state in C# by utilizing ViewState values for a string array

I have a problem where only the latest value is being stored in an array when I loop through. I want to store all values instead. I attempted to use ViewState, but the code snippet below is not producing the desired result. Can someone please assist me w ...

Roslyn retrieves the MethodInfo object by accessing the IMethodSymbol

Is there a reliable way for me to obtain the MethodInfo (through reflection) from an IMethodSymbol in the Roslyn syntax tree? I am able to retrieve the Type from the IMethodSymbol, and within that type, there are multiple methods, one of which matches the ...

The Strapi plugin seems to be encountering an issue as the API is not reachable, leading to a

In an attempt to create a custom API in Strapi backend, I developed a plugin called "test" for testing purposes. However, when trying to access the test response in Postman, it displays a 404 error stating that it is not accessible. Let me provide you wit ...

What causes an Angular Form to be validated before I even click the Submit button?

I have a Dynamic Angular Form. Upon loading the page, the form undergoes validation for errors. My goal is to implement a scroll-to-error directive that can automatically scroll and focus on the error div. However, I am facing an issue where the form is a ...

Is it feasible to retrieve ADFS server users through the Auth0 API in an Asp.net C# MVC application?

Currently, I have successfully integrated ADFS user authentication using the Auth0 API in an ASP.Net application. However, I now have a new requirement to retrieve all ADFS users utilizing the Auth0 API. Is it feasible to fetch all ADFS users through the ...

Switch themes on the fly using Angular 2 and Meteor

I have a web application built with Meteor and Angular 2. I would like to implement a feature that allows users to change the theme by selecting one of two options: <select onChange="changeTheme()"> <option value="blue"> Blue</option> &l ...

Develop an NPM package by bundling various Angular2 components tailored for a CRUD (Create, Read

I am new to Angular2 and have successfully developed three components for managing employees: create/edit, view, and list. The component selectors are <create-employee>, <view-employee>, <list-employee>. My goal is to create a single npm ...

Pass a byte array from the back-end code to an AJAX request

I have a web method where I am converting HTML to PDF and saving it to a local folder. The goal is for the user to download the file without needing to reload the page. To achieve this, I am attempting to make an AJAX POST call to the web method to retriev ...

Mongoose encountered an error when attempting to cast the value "ObjectID" to an ObjectId at the specified path "red.s1"

My Mongoose schema is structured as follows: const gameSchema = new Schema({ matchNumber: { type: Number, required: [true, 'A match must have a number!'], unique: true }, red: { s1: { type: ...

Showing a dynamically updated array in Angular

Within my Angular Application I am utilizing an ngFor loop in the component to display an array. Now, I am filtering the data from the array and aiming to update the newly filtered array in place of the original one. While I can successfully display the ...

Addressing ESLint and TypeScript Issues in Vue.js with Pinia: A comprehensive guide

Experiencing difficulties with Vue.js + Pinia and need assistance to resolve these issues. Error: 'state:' is defined but never used. Here is the snippet of code located in @/stores/user.ts. import { defineStore } from 'pinia' export ...

Tips for avoiding parent div click interference in Angular

Working with Angular8, I have a div containing a routelink along with other components including a checkbox. Here's the structure: <div [routerLink]="['/somewhere', blablabla]"> <!--other components that navigate to the ro ...