-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cdk] ComponentPortal(fooCmp) is not attached to selectedPortal despite implemented according test code examples #11500
Comments
I think i missed something because I found following statement in https://material.angular.io/cdk/portal/overview#portals-in-practice
and the same in testcode example https://github.com/angular/material2/blob/master/src/cdk/portal/portal.spec.ts#L574-L587
After adjusting the stackblitz code according
Whats wrong here? Is something else missing? |
@crisbeto @jelbourn This is really weird, i dont know what happening wrong. There is no error message, nothing! Out there except the testcode (material repo) blog (material) are few tutorials/examples which is based on material2/ckd/portal v6 ! That videos which i found are developed imperative and not how i want to do it in the declarative way ([cdkPortalOutlet]="selectedPortal"). I tried really many things, read the documentation (over and over again), read the testcode (over and over again), tried many uses cases, create stackblitz example. I dont know what can i do anymore? Can anyone look of that issue please, thank you. |
1.) any updates here (see above)? |
@SerkanSipahi just took a look You can't put directives on I filed angular/angular#24259 since Angular should give an error message in this case. |
@jelbourn sorry. I was so stupid. Something goes wrong while i read the example code over and over again! Thank you for angular/angular#24259. This make sense because it doesnt throw an error in my example. BTW: the test code examples helped me o lot to understand how the portals are working (expect that i read someting wrong) P.S. now it works well. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Moved from angular/angular#24111
I'm submitting a...
Current behavior
The component which is created by ComponentPortal will not attached despite implemented according the test code example see: https://github.com/angular/material2/blob/master/src/cdk/portal/portal.spec.ts#L37-L52
Expected behavior
It should attach the created portal component to the
selectedPortal
!Side notes:
The reason why i did it according the test examples is because the official documentation (https://material.angular.io/cdk/portal/overview) was not really helpful for me as a relative new user of angular and the examples on some blogs what i found were outdated because their examples were built top of angular v5 (https://blog.angularindepth.com/angular-cdk-portals-b02f66dd020c).
Additionals: Thethis.portalOutlet
is also not accessible via@ViewChild(CdkPortalOutlet) portalOutlet: CdkPortalOutlet
! I have implemented something like this many times but it seems that is not working with CdkPortalOutlet directive.Minimal reproduction of the problem with instructions
Stackblitz:
https://stackblitz.com/edit/angular-gitter-hm6egs?file=app%2Fapp.component.ts
Preview stackblitz code:
Environment
The text was updated successfully, but these errors were encountered: