This is my HTML code:
<div class="form-group">
<label class="form-control-label" for="field_start">Start</label>
<input type="datetime-local" class="form-control" name="start" id="field_start" [(ngModel)]="service.startDate" />
</div>
Therefore, startDate is stored as a number (Long) but I want to display a datetime-local. I have really no idea how to do it. I'm using the same component for creating and updating a model. Creating is working cause I can manipulate the value in the called function.
You can change 2-way binding [(ngModel)] to separate property and event bindings using [ngModel] and (ngModelChange). Then you can use a pipe to format input value.
Using Pipes within ngModel on INPUT Elements in Angular
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With