The Angular form isn't recognizing when the value is being updated

I'm having trouble with the form - for some reason, the input isn't updating the values in the form. the input does not change the values in the form.

Additionally, the valueChanges method is not detecting any changes. Any suggestions?

The issue can be seen on stackblitz here: https://stackblitz.com/edit/angular-ivy-w68v69?file=src/app/app.component.ts

import { Component, VERSION } from "@angular/core";
import { FormControl, FormGroup, Validators } from "@angular/forms";

@Component({
  selector: "my-app",
  template: `
    <form [formGroup]="form">
      <input
        FormControlName="patientName"
        placeholder="Enter Patient Name ..."
      />
    </form>
  `,
  styleUrls: ["./app.component.css"]
})
export class AppComponent {
  form: FormGroup;

  ngOnInit() {
    this.form = new FormGroup({
      patientName: new FormControl("")
    });

    this.form.get("patientName").valueChanges.subscribe(x => console.log(x));

    this.form.valueChanges.subscribe(next => {
      console.log("valueChanges didtted");
      console.log(next);
    });

    console.log("form created");
  }
}


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

Triggering Events with Angular Checkboxes

I'm having trouble getting a console log to trigger when the user checks one of the checkboxes. The script is working fine for everything else, but checkbox clicks are not registering any events. Any suggestions on why this might be happening? (Just ...

Debounce function fails to properly function when the state is modified within the same function

I've been working on implementing a search-as-you-type feature and I want to debounce the function search that handles API calls. Everything works well when I only call the debounced_search function within the event handler, but I also need to update ...

Getting foreign key data from Django to display in Angular

Looking to fetch all columns of a table using a foreign key relationship and unsure of the process? Here's the code snippet: models.py class Athletes(models.Model): athlete_id = models.AutoField(db_column="AthleteID", primary_key="True") fir ...

Within a lattice composed of variously hued cubes, how can one locate the corresponding clusters?

Explaining Clusters A cluster is a group of cubes of the same color that are touching face planes, not their corners, forming a solid geometric shape. To Aid in Visualization Imagine each Lego piece to be 1x1 units in size. https://i.sstatic.net/z9qFm. ...

The onhashchange function is limited in its ability to completely track changes in the hash

I set up an onhashchange event listener on the page in the following way: window.addEventListener('hashchange', () => console.log('hash change!')) This listener can detect hash changes that I manually enter: However, I am not see ...

Why isn't my Vue.js3 table being updated after using axios asynchronously?

After conducting my research, it appears that I have followed all the correct steps. However, I am unable to identify why my table is not updating. Initially, I create a new company and proceed to the overview, but nothing is being displayed. While checki ...

Combining numerical values

I'm working on a JQuery code where I need to combine the var data with a number...I have the following code: $('div[name=price]').html(""); $.post("getprice.php", { unit: $('input[name=property]:checked').val() , date: $(&ap ...

Issue with passing JSON data to a PHP file using CURL

I am currently working on a project that involves sending exam data with the exam-name and the selected number of questions from a list. Here is the project architecture I am following: To send JSON via AJAX to my make_exam.php file The questions.php fil ...

Step-by-step guide on resolving the error message "Unable to identify the dependencies of task ':app:preDebugBuild'" in Ionic 4 Cordova

Having trouble creating an Ionic 4 android app? Encountering a preDebugBuild error related to play-services-measurement-base and conflicting library versions? I've attempted various fixes including: - Running ionic repair - Reinstalling and updating ...

Incorporating a dropdown feature into the navigation bar

Greetings, I am currently learning on the job as I work on a new website for my family business. I am struggling to make the drop-down navigation menu function properly on both desktop and mobile. I want it to have a simple design similar to the main nav ...

The Jquery code is failing to execute the AJAX GET request

I've included jQuery in my code, but despite that, it seems like my script is not functioning properly. I suspect the issue lies with how I am loading jQuery rather than with my ajax request. There are no error messages appearing and the console.log ...

Google Chrome extension: Communicating from injected content script to background script

/* My Unique Background Code */ console.log("Initializing the Background ! "); chrome.runtime.onMessageExternal.addListener( (request, sender, sendResponse) => { console.log("A message has been received"); console.log(request); ...

Switch out image with Jquery when hovering, and revert to default on mouse out

Despite the numerous times this question has been asked, I am struggling to find a solution that fits my specific case. Let's dive into it. My navigation setup involves using Bootstrap nav pills to navigate through content. The structure looks like t ...

Is there a way to add new content to my HTML page while also updating the DOM without having to refresh the entire page?

Whenever I add new data to a table, the datatables plugins fail to recognize it <javascript>$(document).refresh</javascript> Could there be a function similar to document.refresh that I should be using? ...

Paste the formatted text from clipboard into the body of a react mailto link

I have a requirement for users to easily send a table via email by copying and pasting it into the subject line. You can view a live demo of this feature on CodeSandbox: copy and paste rich text Below is the function that allows users to copy and paste ri ...

Transforming an interactive HTML webpage into React/JSX

Imagine a scenario where I have two files: example.html <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="u ...

Implement functionality in JS to track the number of clicks on an element

I am dealing with a ul-list containing an unpredictable number of li-elements, ranging from 2 to 8. My goal is to capture votes using these li-elements and display the vote count on the specific element that was clicked. I have attempted to catch the click ...

ReactDOM is capable of rendering a single component at a time

My goal is to develop an application that includes a comment feature. I'm currently working with code similar to the following: response.data.forEach((el, idx, arr) => { const newMessage = <CommentMessage username={el.username} message={el.mes ...

What is the best way to set the typing of a parent class to the child constructor?

I am seeking a method to inherit the parameter types of a parent's constructor into the child's constructor. For example: class B extends A { constructor (input) { super(input); } } I attempted the following: class B extends ...

Exploring Tmbd Movie Database with React.js - Results of searches will only display after the application is recompiled

Presented here is my component. The challenge I am facing pertains to the fact that upon entering a search query, no results are displayed until I manually save in the code editor and trigger a recompilation of the application. Is there a more efficient ap ...