Issue with Select Box Value not updating in HTML Document Object Model

The issue I'm facing is that the select box DOM value does not update after the value has been changed in the component.ts file.

Could you please review the code provided below:


    <form class="form-horizontal aformgroups" [formGroup]="PurchaseForm" autocomplete="off">    
    <select class="selectpicker form-control" name="FolioNumberDDl" formControlName="FolioNumberDDl">
      <option *ngFor="let i of FolioNumberData" [ngValue]="i">{{i}}</option>
    </select>
    <input type="radio" (change)="changeSelectValue()" />Change Value
</form>



export class AppComponent  {
  name = 'Angular';
  PurchaseForm;

  FolioNumberData: any = [];

  ngOnInit() {
    this.FolioNumberData = ["Select", "1234", "3256", "5643", "5555"]

    this.PurchaseForm = new FormGroup({
      FolioNumberDDl: new FormControl({ value: '1234'})
    });
    this.PurchaseForm.controls.FolioNumberDDl.setValue("1234")
  }

  changeSelectValue(){
    this.PurchaseForm.controls["FolioNumberDDl"].setValue("1234");
    console.log(this.PurchaseForm.controls.FolioNumberDDl.value, "this.PurchaseForm.controls.FolioNumberDDl.value");
  }

Stackblitz: https://stackblitz.com/edit/angular-d3gpku

I've spent quite a bit of time trying to solve this problem. If anyone can provide assistance, it would be greatly appreciated.

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

If an error 401 occurs, Angular 4 will redirect to the landing page

I am facing an issue with my Angular 4 app which has two modules: guest and user. When a user is not logged in and tries to navigate to .../user, it logs an error in the console. However, I am unable to locate the file responsible for handling this navigat ...

Strange Node.js: I always avoid utilizing `require()`, yet encountered an unexpected error

For more information on this particular issue, please refer to this link It's quite puzzling as I haven't used the require() function in my code, yet I'm receiving an error telling me not to use it. How odd! The problematic code snippet i ...

Angular - Cannot assign operator function of type 'OperatorFunction<IUser, void>' to parameter of type 'OperatorFunction<Object, void>'

While working on adding a user login feature in Angular-13, I have the following model: export interface IUser { email: string; token: string; } Service: export class AccountService { baseUrl = environment.apiUrl; private currentUserSource = new ...

When removing the class "img-responsive" from an image, the bootstrap columns begin to overlap

Just starting out with Bootstrap while working on an Angular2 project and I have a question. Currently, I have a map-component taking up 3 columns on the left-hand side, but every time I resize the browser, the image also resizes. I want the image to rema ...

Guide to waiting for an event to finish in Angular

My component features a scorebar positioned on the left side, with game logic being managed by a separate game service. When a new player joins, I need to temporarily hide the scorebar, update the players array in the game.service, and then display the sco ...

I'm stuck trying to figure out all the parameters for the MapsPage component in Angular 2

Currently, I am utilizing Angular2 with Ionic2 for my mobile app development. Everything was working flawlessly until I decided to incorporate a new module for Google Maps navigation. Specifically, I am using phonegap-launch-navigator for this purpose. The ...

Consolidate multiple sorting functions into a single function to effectively sort by column

Can someone help me simplify my sorting function for array columns? Currently, I have multiple functions like the one below for each column: sort() { if (this.sortAsc == false) { this.tab.sort((a, b) => { return a.name.localeCompare( ...

Angular: Eliminating code duplication through service transfer

One code snippet that I frequently use when booting the app is (ngOnInit): this.route.queryParamMap.subscribe( params => { const id = params.get('id'); if (id) { this.contactsService.GetContactByUserId(id) .subscribe( ...

A guide to writing a script to access and return a specific element stored in an array within an object's property

I have created this specific function function extractSingleValue<T, TElem, K extends keyof T>(obj: T, name: K): TElem { const source = obj[name]; if (source.length !== 1) { throw Error(`There should be exactly one ${name} associated`); } ...

Error: React-Redux Provider is being called incorrectly

I am currently working on a small application to get familiar with using Redux Toolkit. My understanding of React/Redux mainly comes from an outdated Udacity course. Although the error message lists the top 3 reasons for this particular error, none of the ...

TypeScript incorporates a variety of @types versions for react

I made changes to my compilerOptions within the tsconfig.json file with the specified paths "paths": { "react": ["node_modules/@types/react"], "@types/react": ["node_modules/@types/react"] } However, I noticed that @types/react-router is using its o ...

What is the best way to locate values within observable data fields?

let filteredRows$: Observable<any[]> = combineLatest([ this.items$, this.term$, ]).pipe( map(([items, term]) => items.filter( (item) => term === "" || item.product_name === term || ...

Leveraging the async pipe within the ngOnInit lifecycle hook

In my angular application, I have several API calls where I need to display a loading component while waiting for server data. To achieve this, I've implemented a loader service as shown below: import { Injectable } from '@angular/core'; im ...

React Functional Component not working properly following package update

After a 4-month hiatus from programming, I decided to update this project using npm but encountered issues with all my stateless functions. interface INotFoundPageContainerProps { history: any; } class NotFoundPag ...

How can I pass additional props that are not specified in the interface while working with a React TS component?

I am working with a TS React component called MyButton.tsx: import React from 'react' interface MyButtonProps { children: JSX.Element | JSX.Element[], className?: string, variant?: 'big-button' | 'medium-button' | &apos ...

Why do referees attempt to access fields directly instead of using getters and setters?

I am facing an issue with my TypeScript class implementation: class FooClass { private _Id:number=0 ; private _PrCode: number =0; public get Id(): number { return this._Id; } public set Id(id: number) { this._Idprod ...

Creating a unique syntax for custom ngIf directives in Angular

Currently, I am in the process of developing a personalized *ngIf directive that will swap out content with a placeholder during loading. After referencing the *ngIf directive (https://github.com/angular/angular/blob/master/packages/common/src/directives/n ...

Issue encountered with Firebase JS SDK: firebase.d.ts file is missing which leads to a Typescript error when trying to

I'm currently working on an Ionic project with AngularFire. I encountered a typescript error when trying to run ionic cordova build --prod --release android. typescript error '/home/sebinbenjamin/workspace/myapp/node_modules/firebase/firebase. ...

Submitting the form leads to an empty dynamically added row

I am currently working on a gender overview that allows you to edit, add, or delete genders using a simple table. The functionality of adding and deleting rows is already implemented. However, I am facing issues with displaying the correct web API data as ...

Ways to eliminate the lower boundary of Input text

Currently, I am working on a project using Angular2 with Materialize. I have customized the style for the text input, but I am facing an issue where I can't remove the bottom line when the user selects the input field. You can view the red line in t ...