I have the following code
<div class="container">
<form>
<div class="form-group">
<input type="number" class="form-control" id="hours" name="hours"
[(ngModel)]="hours">
{{hours}}
<label for="hours">hr</label>
</div>
<div class="form-group">
<input type="number" class="form-control" id="minutes" name="minutes"
[(ngModel)]="minutes">
{{minutes}}
<label for="minutes">min</label>
</div>
<div class="form-group">
<input type="number" class="form-control" id="seconds" name="seconds"
[(ngModel)]="seconds">
{{seconds}}
<label for="seconds">sec</label>
</div>
</form>
For some reason, only the last input is working, and both hour and minutes are not. I checked just the html file, and that seems to work, and I am able to input in all the fields. But not when using angular.
Angular component class
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-pomodoro',
templateUrl: './pomodoro.component.html',
styleUrls: ['./pomodoro.component.css']
})
export class PomodoroComponent implements OnInit {
@Input() private hours: Number;
@Input() private minutes: Number;
@Input() private seconds: Number;
constructor() {
}
ngOnInit() {
}
}
So this was a really beginner mistake. The pomodoro component was apparently getting displayed over another component and that is why the input fields weren't working. I changed the position using css and now it works.