Skip to content

Portal outlet groups#2081

Open
rchavan10 wants to merge 12 commits intodevelopfrom
portal-outlet-groups
Open

Portal outlet groups#2081
rchavan10 wants to merge 12 commits intodevelopfrom
portal-outlet-groups

Conversation

@rchavan10
Copy link
Collaborator

This issue closes #2045

@rchavan10 rchavan10 requested a review from axdanbol January 23, 2026 17:36
@nx-cloud
Copy link

nx-cloud bot commented Jan 23, 2026

View your CI Pipeline Execution ↗ for commit bc503ab

Command Status Duration Result
nx affected --targets=lint,test,compodoc --conf... ✅ Succeeded 2m 58s View ↗
nx affected --target=build,build-webcomponent,b... ✅ Succeeded 3m 41s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-28 16:11:35 UTC

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

🚀 Preview Deploy Report

✅ Successfully deployed preview here

@rchavan10 rchavan10 self-assigned this Jan 23, 2026
Copy link
Contributor

@axdanbol axdanbol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I need to give some more thought on how this should work so put this on pause for now

*/
@Directive({
selector: '[hraPortalOutletGroup]',
standalone: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove. Standalone is the default

readonly activeOutlet = input<string>('');

/** Query all registered portal outlet name directives within this group */
private readonly outlets: Signal<readonly HraPortalOutletNameDirective[]> = contentChildren(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove. It is the responsibility of the name directive to register with the closest group

*/
@Directive({
selector: '[hraPortalOutletName]',
standalone: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove. Standalone is the default

* Registers itself with the closest HraPortalOutletGroupDirective.
*/
@Directive({
selector: '[hraPortalOutletName]',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to [cdkPortalOutlet][name]

})
export class HraPortalOutletNameDirective implements OnInit, OnDestroy {
/** The name of this outlet, used to identify it within the group */
readonly name = input.required<string>({ alias: 'hraPortalOutletName' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the alias. This should be used in the template like so:

<ng-template cdkPortalOutlet name="my-outlet" />

readonly name = input.required<string>({ alias: 'hraPortalOutletName' });

/** Reference to the CdkPortalOutlet contained within this element */
private readonly portalOutlet = contentChild(CdkPortalOutlet);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be inject(CdkPortalOutlet)

*/
constructor() {
/** Effect to handle name changes and re-register with the group */
effect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the cleanup functionality of effect for unregistering when the name changes like this:

effect((onCleanup) => {
  const name = this.name();
  if (this.group) {
    this.group.register(name, this);
    onCleanup(() => this.group.unregister(name))
  }
})

Then you can also remove the onInit and onDestroy hooks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants