I've been struggling to restrict the input for years to a range of 0-24, but all my attempts have failed. Does anyone have any suggestions on how to achieve this? relevant code snippet from form.html :
<mat-card>
<h1>Add Customer</h1>
<form #customerForm="ngForm">
<mat-form-field>
<input
matInput placeholder="Education years"
[(ngModel)] = "years"
name = "years"
min = "0"
max = "24"
required="required">
</mat-form-field>
</form>
</mat-card>
relevant code snippet from form.ts :
import { Component, OnInit, Input, Output, EventEmitter} from '@angular/core';
import { Customer } from '../interfaces/customer';
@Component({
selector: 'customerform',
templateUrl: './customer-form.component.html',
styleUrls: ['./customer-form.component.css']
})
export class CustomerFormComponent implements OnInit {
@Input() name: string;
@Input() years: number;
@Input() income: number;
@Input() id: string;