Looking to calculate the total value from text boxes in Angular2

In my Angular2 app, I am using a *ngFor loop to display model names retrieved from JSON data. The main template code structure is as follows:

<div *ngFor="#model of datajson.models">
    <models [data]="model"></models>
</div>

Now, in the child component, the code appears like this:

@Component({
    selector: 'models',
    template: `
        {{data.modelname}}
        <input type="text" class="txt-dev-number" [(ngModel)]="devCount"/>
    `,

The last line in the component displays a text box for each model name where users can input numbers. My question is how to calculate the total sum of all the values entered in these text boxes.

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

After importing the shared module in a feature module, Angular components declared in the shared module are not being recognized in the feature modules

I have successfully imported the shared module into my appModule and utilized one of its components without any issues. However, I encountered a problem when I tried to import the shared module into my feature module. Shared Module: @NgModule({ imports ...

What could be the reason behind npm trying to utilize a package version that is not specified in my package.json file?

My Angular and .NET 5 web application is encountering an issue when trying to install packages using the command npm i. The error message that appears is: npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While re ...

Angular 4 fetches the number obtained from a GET request

In my spring-boot back-end app, I have defined a query as shown below: @Query("SELECT COUNT(*) " + "FROM Foo " + "WHERE name = :name and surname = :surname ") Integer countByNameAndSurname(@Param("name") String name, @Param("surnam ...

There seems to be no clear reason as to why the Angular Service is showing

In my DataService component, I have defined two methods - one to read from a file using the cordova-file-plugin and the other to write to it. Initially, it was using the in-mem-web-api, which worked perfectly fine. However, I made some changes to switch th ...

Determining the best method for change detection in Angular 2: Choosing between Observable, EventEmitter, and Dot Rule

Managing change detection in Angular2 can be approached in three different methods that I have observed. Utilizing Observables @Injectable() export class TodosService { todos$: Observable<Array<Todo>>; private _todosObserver: any; ...

Tips on how to flatten an Array of Observables within an Observable

I've been attempting to flatten a nested Observable, but I'm struggling to make it work as intended: this.af.object('test/father') .map(res => { res.namedKeys = []; for (let el in res.keys) { res.namedKeys.push(this ...

Is it possible for me to incorporate antd's less variable into my component?

Query Currently, I am utilizing NG-ZORRO to enhance the standard of my UI design. However, I am facing an issue with aligning the primary color in my business component with Ant Design. After exploring Angular Material's Theming Your Own Components, ...

What is the best method for presenting data in a specific router in Angular?

In the main component, I have created a router: <div class="main-panel"> <app-navbar></app-navbar> <router-outlet></router-outlet> <app-footer></app-footer> </div> Within the app-navbar, there i ...

Tips for postponing the opening of a CDK overlay

Utilizing the CDK Overlay, a "popover" is displayed when a user hovers over an item in a list. Currently, the popover opens upon triggering the mouseenter event. Here is the code snippet: //component.html <mat-list-item *ngFor="let item of itemList" ( ...

Is there a way to stop the BS modal from appearing when I hit Enter after filling out a form?

Currently, I am implementing a form within an Angular framework. Every time I press the Enter key in any input field, it triggers the opening of a bsmodal dialog. ...

Display or conceal elements within a Component with the help of a Service

After developing a custom Tabs component, I have implemented it in the following way (StackBlitz example): <tabs> <tab title="Tab 1"> <div toolbar> <message><span>Message 1: </span></message> &l ...

Converting a promise of type <any> to a promise of type <entity>: A beginner's guide

As a newcomer to TypeScript and NestJS, I am wondering how to convert Promise<any[]> to Promise<MyEntity[]> in order to successfully execute the following code: const usersfromTransaction = this.repoTransaction .createQueryBuilder() ...

Issue with saving component value using Angular's *ngIf directive in Ionic 3

I have created Angular components in Ionic 3 and implemented multiple div tabs using the *ngIf directive. I can successfully switch between tabs using buttons. However, a problem arises when I navigate to another section of the main HTML page containing t ...

Angular2's service executing http method is limited to just once

I have a service that is responsible for retrieving information from the server. The goal is to execute the request only once and then share the data with every component in the application. Currently, my code looks like this: @Injectable() export class P ...

Tips for utilizing canReuse and routerOnReuse in Angular 2

I've reviewed the information provided in this link, but I'm still unsure about how to effectively utilize it. My requirement is straightforward—I need to update a parameter in the URL without constantly sending API requests, which are current ...

What is the process for setting TTL in a browser's cache storage?

As I develop my website as a progressive web app, I am utilizing cache storage and index DB for caching. Is there a way to set a TTL (time-to-live) on the cache storage and DB? Do we need to manually delete the cache or will it be done automatically? ...

Managing absence of ID field in Prisma and retrieving data from API request

When fetching data from an API, my approach looks like this: async function getApiData() { const promises = []; for (let i = 0; i < PAGE_COUNT; i++) { const apiData = fetch(...); } const apiData = await Promise.all(promises); return apiDat ...

The element is not included in any NgModule, or the module has not been properly imported into your module

I am currently working on an angular 4 application and encountering an error: Error:Component HomeComponent is not part of any NgModule or the module has not been imported into your module. My setup includes a HomeModule and a HomeComponent. Now, I am un ...

Expanding the selection of an Angular 2 dropdown on hover

Our form includes multiple mat-selects (dropdown menus) to simplify validation for users by limiting input options. However, many users are finding it tedious to scroll through a long list of items to find the one they need. We are looking for a solution ...

What is the best way to explain the concept of type indexing in TypeScript using its own keys?

I'm still learning TypeScript, so please bear with me if my question sounds basic. Is there a way to specify the index for this type so that it utilizes its own keys rather than just being an object? export type TypeAbCreationModal = { [index: stri ...