Search code examples
angulartextboxangular11

Patch Value to Angular text box without using FormControls and NgModel


I am New to Angular I need to patch value to text box without using FormControls and NgModel while page loading

Here is my code

calendar;

 <input type="date" (change)="customCalanderStartDateHandler($event)"  >



customCalanderStartDateHandler(event) {

    const option = event.target.value;

    const convertDate = new Date(option);
   
    this.calendar = convertDate;
  }

I seek your help to solve this problem . If i need to add any attribute or field or something else please let me Know


Solution

  • try binding value attribute

    //.html
    <input type="text" value={{datePatcher}} (change)="customCalanderStartDateHandler($event)"/>
    
    //.ts
    public datePatcher ="2/11/1999";