{"record":{"id":"2fe5579e78086767","repo":"angular/components","slug":"cdkselectall-cdkselection-must-have-cdkselectionm","errorCode":null,"errorMessage":"CdkSelectAll: CdkSelection must have cdkSelectionMultiple set to true","messagePattern":"CdkSelectAll: CdkSelection must have cdkSelectionMultiple set to true","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cdk-experimental/selection/select-all.ts","lineNumber":104,"sourceCode":"    if (this._controlValueAccessor && this._controlValueAccessor.length) {\n      this._controlValueAccessor[0].registerOnChange((e: unknown) => {\n        if (e === true || e === false) {\n          this.toggle();\n        }\n      });\n      this.checked.pipe(takeUntil(this._destroyed)).subscribe(state => {\n        this._controlValueAccessor![0].writeValue(state);\n      });\n    }\n  }\n\n  private _assertValidParentSelection() {\n    if (!this._selection && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n      throw Error('CdkSelectAll: missing CdkSelection in the parent');\n    }\n\n    if (!this._selection.multiple && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n      throw Error('CdkSelectAll: CdkSelection must have cdkSelectionMultiple set to true');\n    }\n  }\n\n  ngOnDestroy() {\n    this._destroyed.next();\n    this._destroyed.complete();\n  }\n}\n","sourceCodeStart":86,"sourceCodeEnd":113,"githubUrl":"https://github.com/angular/components/blob/0411926e7d8ae06b32236ec1048a888cfad5abf2/src/cdk-experimental/selection/select-all.ts#L86-L113","documentation":"CdkSelectAll's toggling semantics only make sense when the surrounding CdkSelection supports multiple selection. _assertValidParentSelection (called from ngOnInit) throws this dev-mode error when the parent CdkSelection exists but its `multiple` flag is falsy, i.e. cdkSelectionMultiple was not set to true.","triggerScenarios":"Using <cdk-select-all> inside <cdk-selection> where the [multiple] input is absent or false — e.g. <cdk-selection>...</cdk-selection> without [multiple]=\"true\".","commonSituations":"Reusing a single-select cdk-selection and adding a select-all toggle; forgetting the multiple binding when migrating from a checkbox-list pattern; default single-select configuration assumed by copy-pasted markup.","solutions":["Set multiple on the parent: <cdk-selection [multiple]=\"true\">.","If single selection is required, remove the cdk-select-all element — select-all is meaningless for single-select.","Bind multiple to a property rather than hard-coding if the mode is dynamic, and only render cdk-select-all when multiple is true (*ngIf)."],"exampleFix":"// before\n<cdk-selection>\n  <cdk-select-all>Select all</cdk-select-all>\n</cdk-selection>\n// after\n<cdk-selection [multiple]=\"true\">\n  <cdk-select-all>Select all</cdk-select-all>\n</cdk-selection>","handlingStrategy":"validation","validationCode":"if (!selectionState.multiple) {\n  // hide or don't render the select-all control\n  showSelectAll = false;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bind [multiple]=\"true\" on cdk-selection whenever a select-all is present.","Gate cdk-select-all behind *ngIf=\"selection.multiple\".","Review selection mode (single vs multiple) when copying list templates."],"tags":["angular","cdk","selection","experimental","invalid-configuration"],"backgroundTag":"invalid-parent-configuration","analyzedSha":"0411926e7d8ae06b32236ec1048a888cfad5abf2","analyzedAt":"2026-08-31T11:58:23.400Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}