Angular 2 Date Input not binding to date value

后端 未结 10 1922
醉梦人生
醉梦人生 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:31

    In your component

    let today: string;
    
    ngOnInit() {
      this.today = new Date().toISOString().split('T')[0];
    }
    

    and in your html file

    
    

提交回复
热议问题