실습환경: Angular 5
Input 태그에서 type="date" 를 사용 시 ngModel 로 date 객체가 들어가지 않아 아래와 같이 처리를 했다.
test.component.ts
export class TestComponent implements OnInit {
dateObject: string;
constructor(
) {
}
ngOnInit() {
}
...
}
1004lucifer
test.component.html
<input type="date"
[ngModel]="dateObject | date:'yyyy-MM-dd'"
(ngModelChange)="dateObject = $event" />
댓글
댓글 쓰기