Skip to content

Commit

Permalink
chore: use function instead of lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
varnastadeus committed Sep 5, 2018
1 parent c5f1c59 commit 4071d61
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { NgSelectComponent, NG_SELECT_DEFAULT_CONFIG } from './ng-select/ng-select.component';
export { NgSelectComponent, NG_SELECT_DEFAULT_CONFIG, SELECTION_MODEL_FACTORY } from './ng-select/ng-select.component';
export { NgSelectModule } from './ng-select/ng-select.module';
export { NgOption, NgSelectConfig } from './ng-select/ng-select.types';
export { SelectionModel } from './ng-select/selection-model';
4 changes: 2 additions & 2 deletions src/ng-select/ng-select.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { NgOptionComponent } from './ng-option.component';
import { NgOptionHighlightDirective } from './ng-option-highlight.directive';
import { NgDropdownPanelComponent } from './ng-dropdown-panel.component';
import { DefaultSelectionModel } from './selection-model';
import { DefaultSelectionModelFactory } from './selection-model';

@NgModule({
declarations: [
Expand Down Expand Up @@ -54,7 +54,7 @@ import { DefaultSelectionModel } from './selection-model';
NgTagTemplateDirective
],
providers: [
{ provide: SELECTION_MODEL_FACTORY, useValue: () => new DefaultSelectionModel() },
{ provide: SELECTION_MODEL_FACTORY, useValue: DefaultSelectionModelFactory },
{
provide: NG_SELECT_DEFAULT_CONFIG,
useValue: {
Expand Down
4 changes: 4 additions & 0 deletions src/ng-select/selection-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { NgOption } from './ng-select.types';

export type SelectionModelFactory = () => SelectionModel;

export function DefaultSelectionModelFactory() {
return new DefaultSelectionModel();
}

export interface SelectionModel {
value: NgOption[];
select(item: NgOption, multiple: boolean, selectableGroupAsModel: boolean);
Expand Down

0 comments on commit 4071d61

Please sign in to comment.