diff --git a/src/app/app.module.ts b/src/app/app.module.ts index a1c73e1..5116451 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -3,6 +3,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { HttpClientModule } from '@angular/common/http'; import { FormsModule } from '@angular/forms'; +import { ReactiveFormsModule } from '@angular/forms'; import { TieredMenuModule } from 'primeng/tieredmenu'; import { AppRoutingModule } from './app-routing.module'; @@ -18,7 +19,7 @@ import { DialogModule } from 'primeng/dialog'; @NgModule({ declarations: [ - AppComponent, + AppComponent ], imports: [ BrowserModule, @@ -30,6 +31,7 @@ import { DialogModule } from 'primeng/dialog'; HttpClientModule, AppRoutingModule, FormsModule, + ReactiveFormsModule, NflModule, NbaModule, NhlModule, diff --git a/src/app/common/validators/year-range.ts b/src/app/common/validators/year-range.ts new file mode 100644 index 0000000..a64940c --- /dev/null +++ b/src/app/common/validators/year-range.ts @@ -0,0 +1,12 @@ +import { AbstractControl, ValidatorFn } from '@angular/forms'; + +// Custom validator function to validate year range +export function yearRangeValidator(minYear: number, maxYear: number): ValidatorFn { + return (control: AbstractControl): { [key: string]: any } | null => { + const value = control.value; + if (value && (value < minYear || value > maxYear)) { + return { 'yearRange': { min: minYear, max: maxYear } }; + } + return null; + }; +} diff --git a/src/app/nhl/components/roster/roster.component.html b/src/app/nhl/components/roster/roster.component.html index 71643d3..eaf9050 100644 --- a/src/app/nhl/components/roster/roster.component.html +++ b/src/app/nhl/components/roster/roster.component.html @@ -49,53 +49,61 @@