Problem with Infragistics radio button not firing change event when value is set manually

After migrating from Angular 11 to 17, I encountered a strange issue with my application's Infragistics radio button. The change event for the radio button does not trigger manually for the first time, but it works fine when changed through the application side.

To work around this issue, I tried subscribing to the valuechanges and passing the event parameter.

HTML

<div class="d-flex align-mode">
  <label class="title pull-left marginType">Mode</label>
  <div class="d-flex flex-column">
    <label class="radio-inline" style="margin-left: 10px">
      <igx-radio name="automaticSubmission"
                 formControlName="automaticSubmission"
                 (change)="onSubmissionModeChange($event)"
                 (click)="onSubmissionModeClick($event)"
                 value="regular"
                 id="regularSubmissionMode"
                 >Regular</igx-radio>
    </label>
  </div>
  <div class="d-flex flex-column marginFifteen">
    <label class="radio-inline ml-5 pl-4">
      <span *ngIf="automaticDisable; else enableAutomatic" (click)="showDisableMessage()">
        <igx-radio [disabled]="true"></igx-radio>
      </span>
      <ng-template #enableAutomatic>
        <igx-radio name="automaticSubmission"
                   formControlName="automaticSubmission"                               
                   (change)="onSubmissionModeChange($event)"
                   (click)="onSubmissionModeClick($event)"
                   value="automatic"
                   id="automaticSubmissionMode">Automatic</igx-radio>
      </ng-template>
      
    </label>
  </div>
</div>

TypeScript

 this.submissionForm = this.fb.group({
    automaticSubmission: ''
 });
        
 ngOnInit (): void {
    this.submissionForm.controls.automaticSubmission.setValue('regular');
 }
 
 onSubmissionModeChange (event) {
    alert(event.value);
    this.clearanceSubmissionFacade.setSubmissionMode(event.owner);
 }

Answer №1

It seems that there is no form in your markup. Have you checked the console of your application? Any errors should be logged there like the following:

ERROR Error: NG01050: formControlName must be used with a parent formGroup directive.  You'll need to add a formGroup
      directive and pass it an existing FormGroup instance (you can create one in your class).

    Example:

    
  <div [formGroup]="myGroup">
    <input formControlName="firstName">
  </div>

  In your class:

  this.myGroup = new FormGroup({
      firstName: new FormControl()
  });

To resolve this issue, update your markup as follows:

    <form [formGroup]="submissionForm">
      <label class="radio-inline" style="margin-left: 10px">
        <igx-radio
          name="automaticSubmission"
          formControlName="automaticSubmission"
          value="regular"
          (change)="onSubmissionModeChange($event)"
          id="regularSubmissionMode"
          >Regular</igx-radio
        >
      </label>
  </form>

Note: After examining the code in your typescript file, it appears that the radio button is being initialized with a value. This means it will be initially checked and since it is not within a radio group, it cannot be unchecked via the UI.

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

Enhancing the session object with new properties

I am attempting to include extra properties in the session object req.session.confirmationCode = confirmationCode; However, I encounter an error stating that the property confirmationCode does not exist Property 'confirmationCode' does not exist ...

Utilizing Angular to Build a Single Router with Numerous Components

Within my Angular application, I am facing a challenge with two components: DashboardComponent and LoginComponent. When a user accesses the URL http://localhost:4200, I need to display the LoginComponent if the user is not logged in. However, if the user i ...

Using Visual Studio Code Build Tasks in Harmony

The documentation for Visual Studio Code includes examples of tasks.json configurations that allow for either typescript compilation or markdown compilation, but does not provide clear instructions on how to achieve both simultaneously. Is there a way to ...

how can JavaScript be used to retrieve an object based on a condition from an array of objects and an ArrayList

My JavaScript challenge involves working with an array of objects called arrobj and a list called prgList. The goal is to extract the names from arrobj based on the programs listed in prgList. If the program exists in arrobj, it should be displayed accor ...

Ways to create a versatile function for generating TypedArrays instances

I'm working on a function that looks like this: export function createTypedArray<T extends TypedArray>( arg : { source : T, arraySize : number } ) : T { if( arg.source instanceof Int32Array ) { return new Int32Array( arg.arraySize ); } ...

The focus of the input is lost when the value is being edited, specifically in the case where ngFor and ng

I'm facing an issue with a simple list that binds two-way to a parameter hero in my hero.component.ts. Whenever I begin typing in the input field, it seems to lose focus and I have to click on it again. How can I ensure that users are able to edit th ...

The Typescript SyntaxError occurs when attempting to use an import statement outside of a module, typically within a separate file that contains

I am currently developing a Minecraft bot using the mineflayer library from GitHub. To make my code more organized and reusable, I decided to switch to TypeScript and ensure readability in my project structure (see image here: https://i.stack.imgur.com/znX ...

Error Encountered: Monorepo Shared Package Not Detected in Docker-Compose Execution

In my development setup, I have organized a monorepo using lerna and yarn workspaces. All code is written in typescript and then compiled into javascript. However, I encountered an issue with sharing packages when running the monorepo with docker-compose. ...

What is the method for dynamically assigning a name to ngModel?

I have the following code snippet: vmarray[]={'Code','Name','Place','City'} export class VMDetail { lstrData1:string; lstrData2:string; lstrData3:string; lstrData4:string; lstrData5:string; ...

How can I retrieve query parameters in the Server app directory of Next.js 13 using a function?

I am looking to retrieve a query token from localhost/get/point?token=hello. import { NextResponse } from 'next/server' import base64url from 'base64url' type Params = { token: string } export async function GET(req: Request, contex ...

At times, MomentJS may miscalculate and add an incorrect number of hours

My goal is to add a specific amount of hours to a 24-hour time, but I'm encountering an issue with the time 00:00. The code I've written works correctly for all times except midnight. For example, if I have 01:30 and add 1 hour, it gives me 02:3 ...

Instructions for resolving the issue "Property 'focus' does not exist on type 'string'"

Struggling with an error message in my react typescript code: "Property 'focus' does not exist on type 'string'". Any help on resolving this issue would be appreciated. <!-- Let's start coding --> import { useRef, ...

The best location to place a main.scss file within an Angular 2 project

I'm wondering where the best place is to put a main.scss file so that it can be utilized by all components. I attempted to place the css in app.component.ts (root component), but the styles weren't being applied to one of my components. Issue Re ...

Unable to establish a connection with the server data in pusher.js

I have been trying to set up a collaborative drawing application by following this tutorial. Although I have managed to run the application, the collaborative drawing feature is not working as expected. I have correctly configured the PUSHER_APP_ID, PUSHER ...

Angular and WEB API experiencing issues with the update function synchronization

Currently, I'm developing a CRUD example using dotnet core and Angular. In the backend, I have implemented a function in the CarController.cs as shown below: CarController.cs [Route("UpdateCar")] [HttpPut] public IActionResult Put([ ...

Discovering the specific p-checkbox in Angular where an event takes place

Is there a way to assign an ID to my checkbox element and retrieve it in my .ts file when the checkbox is selected? I want to pass this ID along with the true or false value that indicates if the checkbox is checked. Here's an example code snippet: &l ...

Unable to set textAlign column property in Inovua React Data Grid using typescript

I am currently facing an issue with centering the content of each grid cell in Inovua RDG. A frustrating TypeScript error keeps popping up: Type '{ name: string; header: string; textAlign: string; defaultFlex: number; defaultVisible?: undefined; }&apo ...

What is the reason for TypeScript disabling unsecure/non-strict compiler rules by default?

Recently, I found myself having to enable a slew of compiler options in my application: "alwaysStrict": true, "extendedDiagnostics": true, "noFallthroughCasesInSwitch": true, "noImplicitAny", true, "noImplicitThis", true, "noImplicitReturns": true, "noUnu ...

`Is there a way to implement a collapsing toolbar in Ionic 3?`

I am looking to design a page similar to the one shown above. The layout includes an image positioned at the top of two divisions, or sandwiched between a toolbar and content as seen in the image above. I have been unable to find any resources or documen ...

Display the Slug in the Website URL upon clicking on a Blog Post using Angular and Strapi framework

When a user clicks on a blog, I want the URL to display the slug instead of the ID. My frontend framework is Angular and I have created a service to fetch data from the backend built with Strapi. Currently, when selecting a blog from the view, the URL disp ...