Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
varnastadeus committed Jun 15, 2019
1 parent e01e310 commit c552663
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,25 @@ map: {
| NgSelectConfig | configuration | Configuration provider for the NgSelect component. You can inject this service and provide application wide configuration. |
| SELECTION_MODEL_FACTORY | service | DI token for SelectionModel implementation. You can provide custom implementation changing selection behaviour. |

## Custom selection logic
Ng-select allows to provide custom selection implementation using `SELECTION_MODEL_FACTORY`. To override [default](https://github.com/ng-select/ng-select/blob/master/src/ng-select/selection-model.ts) logic provide your factory method in your angular module.

```javascript
// app.module.ts
providers: [
{ provide: SELECTION_MODEL_FACTORY, useValue: <SelectionModelFactory>CustomSelectionFactory }
]

// selection-model.ts
export function CustomSelectionFactory() {
return new CustomSelectionModel();
}

export class CustomSelectionModel implements SelectionModel {
...
}
```

## Change Detection
Ng-select component implements `OnPush` change detection which means the dirty checking checks for immutable
data types. That means if you do object mutations like:
Expand Down

0 comments on commit c552663

Please sign in to comment.