question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attempting to attach an unknown Portal type. BasePortalOutlet accepts either a ComponentPortal or a TemplatePortal.

See original GitHub issue

Just got this error in production.

"dependencies": {
"ng-pick-datetime": "^6.0.4",
"@angular/cdk": "^6.1.0",
"@angular/material": "^6.1.0",
"@angular/core": "6.0.3",
........

"devDependencies": {
    "@angular/cli": "6.0.3",
    "@angular/compiler-cli": "6.0.3",

this is how my code looks:

<mat-form-field>
           <input (change)="calculateTotal()" (dateTimeChange)="calculateTotal();"
                       matInput placeholder="Date Time To:"
                       [owlDateTimeTrigger]="dt13"
                       [owlDateTime]="dt13"
                       [(ngModel)]="range"
                       selectMode="rangeTo">
           <owl-date-time firstDayOfWeek="6" #dt13></owl-date-time>
</mat-form-field>

So as you can see I use matInput here also, and mat-form-field as a wrapper, so maybe this can cause some conflicts. In development mode everything works perfectly.

Here is the production error trace if it helps:

0.83a6145142c144fbb003.chunk.js:1 ERROR Error: Attempting to attach an unknown Portal type. BasePortalOutlet accepts either a ComponentPortal or a TemplatePortal.
    at 0.83a6145142c144fbb003.chunk.js:1
    at e.t.attach (0.83a6145142c144fbb003.chunk.js:1)
    at t.attach (0.83a6145142c144fbb003.chunk.js:1)
    at e.openAsPopup (0.83a6145142c144fbb003.chunk.js:1)
    at e.open (0.83a6145142c144fbb003.chunk.js:1)
    at t.handleClickOnHost (0.83a6145142c144fbb003.chunk.js:1)
    at Object.handleEvent (main.83a6145142c144fbb003.bundle.js:1)
    at Object.handleEvent (0.83a6145142c144fbb003.chunk.js:1)
    at Object.handleEvent (0.83a6145142c144fbb003.chunk.js:1)
    at Kr (0.83a6145142c144fbb003.chunk.js:1)
Ut @ 0.83a6145142c144fbb003.chunk.js:1
t.handleError @ 0.83a6145142c144fbb003.chunk.js:1
Kr @ 0.83a6145142c144fbb003.chunk.js:1
(anonymous) @ 0.83a6145142c144fbb003.chunk.js:1
(anonymous) @ 0.83a6145142c144fbb003.chunk.js:1
t.invokeTask @ 0.83a6145142c144fbb003.chunk.js:1
onInvokeTask @ 0.83a6145142c144fbb003.chunk.js:1
t.invokeTask @ 0.83a6145142c144fbb003.chunk.js:1
e.runTask @ 0.83a6145142c144fbb003.chunk.js:1
e.invokeTask @ 0.83a6145142c144fbb003.chunk.js:1
v @ 0.83a6145142c144fbb003.chunk.js:1
b @ 0.83a6145142c144fbb003.chunk.js:1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
MardariGcommented, Jun 6, 2018

I’ve used webpack until now, and now just migrated to angular CLI latest version, to test this issue, and it happens again. Just make a build with --prod and it fails when you try to open the datepicker modal.

2reactions
dbusaccacommented, Jun 7, 2018

I’ve had this Issue: I the package.json of the project I’ve had: "@angular/animations": "~6.0.3", "@angular/cdk": "~6.2.0", ng-pick-datetime requires @angular/cdk": "^6.0.0",

Because of this a differente copy of @angular/cdk was pullend on the “private” node_module of ng-pick-datetime

I’ve resolved setting the my project dependency to “@angular/cdk”: “^6.0.0”

Still i think that @angular/cdk should be declared as peer dependency

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular - Portal host doesn't render template portal in Material 2
I'm referencing the Material 2 documentation to try to set up a template portal that gets rendered in a nearby host (actual usage...
Read more >
Portal - Angular Material
BasePortalOutlet. Partial implementation of PortalOutlet that handles attaching ComponentPortal and TemplatePortal. Properties. Name, Description.
Read more >
Angular CDK Portals - Medium
A Portal is a piece of UI that can be dynamically rendered to an open slot on the page. The “piece of UI”...
Read more >
angular/cdk - UNPKG
... {\n throw Error('Attempting to attach an unknown Portal type. BasePortalOutlet accepts either ' +\n 'a ComponentPortal or a TemplatePortal.
Read more >
Inject dynamic content in Angular components with portals
Upon the selection change, the selected service type data is pushed into the ... ComponentPortal : create a portal from a component type....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found