Skip to content

Commit

Permalink
Refactor DynamicFormControlListDataProvider to a generic interface fo…
Browse files Browse the repository at this point in the history
…r consistency
  • Loading branch information
Steve Rhoades authored and Steve Rhoades committed Jan 17, 2020
1 parent b9fbdf3 commit 2e934b1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export interface DynamicFormControlDataConfig {
service: any;
}

export interface DynamicFormControlListDataProvider {
fetchList(value: string): Observable<any[]>;
export interface DynamicFormControlListDataProvider<T> {
fetchList(value: string): Observable<T[]>;
}

export interface DynamicFormControlOptionDataProvider<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {DynamicFormGroupModel} from '../model/form-group/dynamic-form-group.mode
import {DynamicFormOptionConfig} from '../model/dynamic-option-control.model';

@Injectable()
class TestProvider implements DynamicFormControlListDataProvider, DynamicFormControlOptionDataProvider<string> {
fetchList(value: string): Observable<any[]> {
class TestProvider implements DynamicFormControlListDataProvider<string>, DynamicFormControlOptionDataProvider<string> {
fetchList(value: string): Observable<string[]> {
return of(['test']);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class DynamicFormDataService {
});
}

isListProvider(provider: DynamicFormControlListDataProvider): boolean {
isListProvider(provider: DynamicFormControlListDataProvider<any>): boolean {
return provider.fetchList !== undefined;
}

Expand Down

0 comments on commit 2e934b1

Please sign in to comment.