unable to modify the attributes of an object in Angular

I've been tasked with modifying an existing Angular project that includes a component where I have the following variable:

public testRunDetails: ITestRunDetails[] = [];

The variable testRunDetails is of type ITestRunDetails, which is defined as:

export interface ITestRun {
    ExecutionStartedOn: string;
    ExecutionEndedOn: string;
    ExecutionStatus: string;
    ExecutionResult: string;
    TotalCnt?: number;
    PassedCnt?: number;
    FailedCnt?: number;
    CompletedCnt?: number;
    ...
    ...
}

I'm attempting to modify the properties of this variable within a function like so:

public changeRunStausRealTime() {
    this.hubConnection.on('transfermessage', (data) => {
      console.log('Message from signalr')

      for (var test of this.testRunDetails) {
        test.ExecutionStatus = "Completed"
        test.ExecutionResult = "Passed"
        test.CurrentStatus = "Test Execution - Pass"
      }
    }
    )

The properties ExecutionStatus and ExecutionResult are part of the ITestRun interface, but CurrentStatus is not. However, when debugging the code, I can see the CurrentStatus property for the test object https://i.sstatic.net/v1v9H.png

Although I'm trying to update the values of ExecutionStatus, ExecutionResult, and CurrentStatus properties, only ExecutionStatus and ExecutionResult are being modified while CurrentStatus remains unchanged. This has left me puzzled as to why I can't update the value of CurrentStatus. Additionally, why does it appear in the developer tools if it's not actually a property of the test object?

Answer №1

Consider placing your code within the start() block, followed by then() and catch()

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

Transforming time into luxon time frames and hours

Is there a way to convert this block of code from moment.js to luxon? Here is the code snippet for reference: The following code is written using moment.js, but I would like to achieve the same functionality using luxon. timezone: null, getIn: moment() ...

Facing a continuous issue where the Angular Universal Bundle keeps loading but only displays a

As I attempted to convert a basic Angular application into a universally supported application, I made all the necessary changes such as adding checks on DOM elements like window, navigator, setTimeout, etc. After running the command npm run build:ssr &am ...

Python's ability to nest objects within other objects allows for complex data

I had an interesting experience during a quiz in my class. One of the questions stated that an object in Python cannot contain other objects within itself, which didn't quite add up to me. After all, why couldn't there be a class table and a clas ...

Ionic 2 - Error: Module ""."" not found at runtime

Encountered a perplexing error while running my Ionic 2 application on localhost using the command: ionic serve I've diligently inspected all my imports for any incorrect paths in my TypeScript files, but haven't found anything amiss. The only ...

Unable to integrate BokehJS with Angular8

Here is the error log that appeared in the browser: AppComponent.html:1 ERROR TypeError: FlatBush is not a constructor at new SpatialIndex (vendor.js:90501) at AnnularWedgeView.push../node_modules/bokehjs/build/js/lib/models/glyphs/xy_glyph.js.XYG ...

Start a HTML 5 video and pause any others playing

On my webpage, I have a series of HTML5 videos listed, but I want to ensure that when one video is played, the others automatically stop or pause. The framework I am using is Angular 2 with TypeScript. <video controls (click)="toggleVideo()" #videoPla ...

What is the best way to associate and merge lists from one object to another object using unique identifiers?

I have a task that involves extracting information from two JSON files. The goal is to log the names from one file and for each name, list the corresponding titles from the other file. The connection between the two files is made using an ID, although one ...

Experimenting with NGXS selectors: A comprehensive guide

Hey there, I am currently utilizing the NGXS state management library in my application. I have a selector set up like this and everything seems to be functioning correctly. However, while testing the app, I encountered the following error message: "PrintI ...

Unique and custom validation decorator within NestJS, applicably used on the service layer

I am using a subscribe function in a nestjs service to receive rabbit messages. @RabbitSubscribe({ exchange: 'test'. routingKey: 'test', queue: 'q' }) async handleEvent( msg: msgModel) { console.log(messa ...

Troubleshooting an Ionic 3 application on a Mac with an iOS emulator

Currently, I am attempting to troubleshoot Ionic 3 TypeScript files using Safari developer tools. I have successfully enabled emulation and am able to detect the emulator on Safari. Within my project, I have various pages and components files, but I am st ...

Using the css function within styled-components

Struggling with implementing the media templates example from the documentation and figuring out how to type the arguments for the css function in plain JS: const sizes = { desktop: 992 } const media = Object.keys(sizes).reduce((acc, label) => { ...

Writing a CSV file to AWS S3 proves to be unsuccessful

I have been working with TypeScript code that successfully writes a CSV file to AWS S3 when running locally. However, I have recently encountered an error message: s3 upload error unsupported body payload object NOTES: The code is not passing creden ...

Utilizing ALERTIFY JS (v1.9.0) with Angular 2: Step-by-Step Guide

I am having trouble implementing AlertifyJS (v1.9.0) in my Angular 2 application. In the vendor.ts file, I have included the following: import "alertifyjs/build/alertify.min.js"; import "alertifyjs/build/css/alertify.min.css"; and made a call to alertify ...

How can one break down enum values in typescript?

I've defined an enum in TypeScript as shown below: export enum XMPPElementName { state = "state", presence = "presence", iq = "iq", unreadCount = "uc", otherUserUnreadCount = "ouc", sequenc ...

Issue: Unable to link to 'FormGroup' because it is not recognized as a valid property of 'form'

app.module.ts import { BrowserModule } from '@angular/platform-browser'; import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core'; import {RouterModule} from '@angular/router'; import {AppRoutes} from './app.routin ...

Is it possible to implement Angular Universal on Github Pages?

Is it doable to Deploy Angular Universal on Github Pages? I've come across some solutions such as angular-cli-ghpages, but from what I understand, these options don't pre-render content for SEO purposes. ...

Tips for incorporating a randomly generated number in WGSL!

Looking to implement a fragment shader within a WebGPU application to generate a black and white image noise effect. For more information on white noise, you can refer to White noise (wikipedia). The goal is for each pixel to have a random color value. I& ...

Tips for efficiently finding and comparing text within the results generated by a for loop in Angular/Javascript

In my XML data, I have extracted all the tag names using a for loop and some other logic. Now, I am looking to find the word 'author' from the output values that are displayed in the console during the loop. If any of the output values match &apo ...

Is there a way to alter the date format for input elements within formGroups using Angular 7?

When the input is of type 'Date', the date format is dd/MM/yyyy. I need to convert the date format from MM/dd/yyyy to dd/MM/yyyy (Turkish Format and Turkish Calendar). Below is the code snippet. <form [formGroup]="opportunityForm" (ngSubmit ...

What is the correct way to link an array with ngModel using ngFor loop in Angular?

Utilizing ngModel within an ngFor iteration to extract values from a single input field like this : <mat-card class="hours" > <table id="customers"> <thead > <th >Project</th> ...