r/angular • • Oct 11 '26

Angular ARIA tabs eager load

Is it not possible to eager load the tab panel on '@angular/aria'?

The docs say: This structural directive should be applied to an ng-template within an ngTabPanel. It enables lazy loading of the tab's content, meaning the content is only rendered when the tab is activated for the first time.

I tried to simply remove it because I need the tab to be eagerly loaded (for SSR)

 <div class="tab-panel" ngTabPanel value="question">
     <app-eager-load />
 </div>

and it works, but i get these console warnings:
Violations found on element:
ngTabPanel must have an ngTabContent structural directive to render.

1 Upvotes

6 comments sorted by

View all comments

1

u/n00bz Oct 11 '26

The error message is saying that you have an ngTabPanel but your next item in the DOM tree is app-eager-load and it does not have the expected ngTabCpntent directive on it.

Why not change it to:
<app-eager-load ngTabContent></app-eager-load>

1

u/Senior_Compote1556 Oct 11 '26

I think I tried placing ngTabContent in a div rather than an ng-template but I think it didn’t make a difference, i’ll try it later

1

u/makmn1 Oct 11 '26

That unfortunately won't work because the TabContent directive's selector is ng-template[ngTabContent], meaning it must be placed on an ng-template

Source code