import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
import { SelectOptionsItem } from '../../../../types/select-options-item.model'
-export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | string
+export type ItemSelectCheckboxValue = { id?: string, group?: string } | string
@Component({
selector: 'my-select-checkbox',
@Input() selectedItems: ItemSelectCheckboxValue[] = []
@Input() selectableGroup: boolean
@Input() selectableGroupAsModel: boolean
- @Input() maxSelectedItems: number
@Input() placeholder: string
ngOnInit () {
} else {
this.selectedItems = items
}
-
- this.propagateChange(this.selectedItems)
}
registerOnChange (fn: (_: any) => void) {
}
compareFn (item: SelectOptionsItem, selected: ItemSelectCheckboxValue) {
- if (typeof selected === 'string') {
+ if (typeof selected === 'string' || typeof selected === 'number') {
return item.id === selected
}