Angular 2 Date Input not binding to date value

后端 未结 10 1935
醉梦人生
醉梦人生 2021-01-30 16:16

trying to get a form set up but for some reason, the Date input in my html is not binding to the object\'s date value, despite using [(ngModel)]

html:

&l         


        
10条回答
  •  粉色の甜心
    2021-01-30 16:46

    In Typescript - app.component.ts file

    export class AppComponent implements OnInit {
        currentDate = new Date();
    }
    

    In HTML Input field

    
    

    It will display the current date inside the input field.

提交回复
热议问题