Closed
Description
Reproduction
Use StackBlitz to reproduce your issue:
https://stackblitz.com/edit/angular-ivy-b4babe?file=src/app/app.component.ts
Steps to reproduce:
- Attach a component portal.
- Call has attached method.
Expected Behavior
What behavior were you expecting to see?
Return true.
Actual Behavior
What behavior did you actually see?
Return false.
Environment
- Angular: 11.2.7
- CDK/Material: 11.2.6
- Browser(s): Firefox
- Operating System (e.g. Windows, macOS, Ubuntu): macOS
Notes
The attach works fine, the issue happens because calling attachComponentPortal directly won't set _attachedPortal and hasAttached won't work as expected. A solution would be the attachs specific methods set _attachedPortal or make the attaches methods private if they are not meant to be called.