in my project I have an array of years which I want to filter based on person's age, Max age is 65 years, so for example if a person is 61 years old in years array will be only 3 and 4. How can i achieve that? here is my stackblitz
.html
<input
matInput
formControlName="birthDate"
type="text"
class="form-control age"
placeholder="ex: 25"
required/>
<carousel
#myCarousel
height="100%"
width="120"
cellsToShow="1"
overflowCellsLimit="3"
id="age" >
<div class="carousel-cell" *ngFor="let year of years">
{{ year.year }}Years
</div>
</carousel>
.ts
years = [
{
year: 3,
value: 3,
},
{
year: 4,
value: 4,
},
];
next() {
this.personAge = (this.formGroup.get('formArray') as FormArray)
.at(0)
.get('birthDate').value;
console.log(this.personAge);
this.period = this.myCarousel.slideCounter + 3;
console.log(this.period);
}