Skip to content

bug(aria-grid): ngGridCell fails with NG0201 (No provider found for GRID_ROW) when used inside cdk-table #32603

Description

@joldibaev

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

When using the new @angular/aria/grid directives in combination with @angular/cdk/table, adding the ngGridCell directive to a th or td inside a cdkColumnDef results in a runtime error: NG0201: No provider found for InjectionToken GRID_ROW.

It seems that because cdk-table renders rows and cells using templates and portals, the DI tree is broken, and ngGridCell cannot find the parent ngGridRow directive, even though they are visually nested in the DOM.

@Component({
  imports: [CdkTableModule, Grid, GridRow, GridCell],
  template: `
    <table ngGrid cdk-table [dataSource]="data">
      @for (column of columns; track column) {
        <ng-container [cdkColumnDef]="column">
          <th ngGridCell cdk-header-cell *cdkHeaderCellDef>{{ column }}</th>
          <td ngGridCell cdk-cell *cdkCellDef="let row">{{ row[column] }}</td>
        </ng-container>
      }
      <tr ngGridRow cdk-header-row *cdkHeaderRowDef="columns"></tr>
      <tr ngGridRow cdk-row *cdkRowDef="let row; columns: columns"></tr>
    </table>
  `
})
export class MyTable { ... }

Expected Behavior
The ngGridCell should be able to locate the GridRow provider when rendered within a cdk-table row, or the package should provide a mechanism to link them when standard DI fails due to template portaling.

Actual Behavior
The application crashes with: ERROR ɵNotFound: NG0201: No provider found for InjectionToken GRID_ROW. Source: Standalone[_App]

Please provide a link to a minimal reproduction of the bug

https://github.com/joldibaev/trade-trade3-ng/tree/table/src/app/components/table

Please provide the exception or error you saw

main.ts:5 ERROR ɵNotFound: NG0201: No provider found for `InjectionToken GRID_ROW`. Source: Standalone[_App]. Find more at https://v21.angular.dev/errors/NG0201
    at createRuntimeError (_untracked-chunk.mjs:595:17)
    at NullInjector.get (_untracked-chunk.mjs:876:21)
    at R3Injector.get (_untracked-chunk.mjs:1201:27)
    at R3Injector.get (_untracked-chunk.mjs:1201:27)
    at R3Injector.get (_untracked-chunk.mjs:1201:27)
    at ChainedInjector.get (_debug_node-chunk.mjs:7490:32)
    at lookupTokenUsingModuleInjector (_debug_node-chunk.mjs:890:31)
    at getOrCreateInjectable (_debug_node-chunk.mjs:913:10)
    at ɵɵdirectiveInject (_debug_node-chunk.mjs:7524:17)
    at ɵɵinject (_untracked-chunk.mjs:677:40)
handleError @ _untracked-chunk.mjs:2581
(anonymous) @ _untracked-chunk.mjs:2597
runOutsideAngular @ _untracked-chunk.mjs:2556
(anonymous) @ _untracked-chunk.mjs:2590
_loadComponent @ _debug_node-chunk.mjs:12007
(anonymous) @ _debug_node-chunk.mjs:11878
run @ _untracked-chunk.mjs:2550
bootstrapImpl @ _debug_node-chunk.mjs:11846
bootstrap @ _debug_node-chunk.mjs:11842
(anonymous) @ core.mjs:672
Promise.then
(anonymous) @ core.mjs:654
_callAndReportToErrorHandler @ core.mjs:700
(anonymous) @ core.mjs:649
run @ _untracked-chunk.mjs:2550
bootstrap @ core.mjs:613
internalCreateApplication @ core.mjs:1743
bootstrapApplication @ _browser-chunk.mjs:271
(anonymous) @ main.ts:5
_debug_node-chunk.mjs:10538 Angular is running in development mode.

Please provide the environment you discovered this bug in (run ng version)

- Angular: 21.0.0
- CDK: 21.0.4 (implicit via @angular/build)
- ARIA: 21.0.5
- Package Manager: npm 10.9.4

Anything else?

No response

Activity

  1. transferred this issue fromangular/angularon Dec 28, 2025
  2. added
    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
    and removed
    needs triageThis issue needs to be triaged by the team
    on Jan 13, 2026
  3. crisbeto commented on Jan 20, 2026

    @crisbeto
    Member

    I spent a bit of time looking into it. The problem is that DI works based on where the element is declared and since in this case the cells are declared outside of the row, the resolution doesn't work. We could make it work for the column with some tweaks to the CDK table, but the row also looks for the items using contentChildren which would be harder.

  4. stephenlautier commented on Mar 12, 2026

    @stephenlautier

    It seems that most of the aria components suffer from the same issue if you try to rewrap to customize, have the same exact issue with the ngListbox/ngCombobox ☹️

  5. self-assigned this
    on Apr 1, 2026
  6. ok7sai commented on May 18, 2026

    @ok7sai
    Member

    Per #33172 Grid directives will replace contentChildren with revere registering/unregistering for binding between directives. However, this doesn't mean it will work seamlessly with the cdk-table as it was not designed to be used together. The cdk-table and ngGrid might end up overriding each others aria attributes.

    Aside from the repoted issue, I wonder what's the intention of using both together?

  7. added
    needs: clarificationThe issue does not contain enough information for the team to determine if it is a real bug
    on May 18, 2026
  8. angular-automatic-lock-bot commented on Aug 2, 2026

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  9. locked and limited conversation to collaborators on Aug 2, 2026
  10. added a commit that references this issue on Sep 23, 2026
    31051cb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: aria/gridneeds: clarificationThe issue does not contain enough information for the team to determine if it is a real bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions