diff --git a/example-app/src/app/material/mat-list-option-fix.ts b/example-app/src/app/material/mat-list-option-fix.ts new file mode 100644 index 00000000..b1c1df21 --- /dev/null +++ b/example-app/src/app/material/mat-list-option-fix.ts @@ -0,0 +1,14 @@ + +import { Directive, Host, OnDestroy } from '@angular/core'; +import { MatListOption } from '@angular/material/list'; + +@Directive({ + selector: 'mat-list-option', +}) +export class MatListOptionFixDirective implements OnDestroy { + constructor(@Host() private matDirective: MatListOption) { } + + ngOnDestroy() { + this.matDirective.selectionList = { _reportValueChange: () => void 0 } as any; + } +} diff --git a/example-app/src/app/material/material.module.ts b/example-app/src/app/material/material.module.ts index a7eb5bcb..0e6723be 100644 --- a/example-app/src/app/material/material.module.ts +++ b/example-app/src/app/material/material.module.ts @@ -17,6 +17,7 @@ import { import { CustomErrorStateMatcherDirective } from './error-state-matcher'; import { NgrxMatSelectValueAccessor } from './mat-select-value-accessor'; +import { MatListOptionFixDirective } from './mat-list-option-fix'; @NgModule({ imports: [ @@ -36,6 +37,7 @@ import { NgrxMatSelectValueAccessor } from './mat-select-value-accessor'; declarations: [ NgrxMatSelectValueAccessor, CustomErrorStateMatcherDirective, + MatListOptionFixDirective, ], exports: [ MatInputModule, @@ -52,6 +54,7 @@ import { NgrxMatSelectValueAccessor } from './mat-select-value-accessor'; MatNativeDateModule, NgrxMatSelectValueAccessor, CustomErrorStateMatcherDirective, + MatListOptionFixDirective, ], providers: [ { provide: MAT_PLACEHOLDER_GLOBAL_OPTIONS, useValue: { float: 'always' } }