Skip to content
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

ReferenceError: Document is not defined #2406

Closed
hadirsa opened this issue May 24, 2018 · 6 comments
Closed

ReferenceError: Document is not defined #2406

hadirsa opened this issue May 24, 2018 · 6 comments

Comments

@hadirsa
Copy link

hadirsa commented May 24, 2018

I have an Angular 6 SSR app and i have added ng-bootstrap, but on SSR build and run i get error bellow

Bug description:

ReferenceError: Document is not defined
    at NgbFocusTrapFactory.ctorParameters (J:\Java\workstation\front\.server\server.js:2221:48333)
    at ReflectionCapabilities._ownParameters (J:\Java\workstation\front\.server\server.js:76:1668)
    at ReflectionCapabilities.parameters (J:\Java\workstation\front\.server\server.js:76:2482)
    at JitReflector.parameters (J:\Java\workstation\front\.server\server.js:3226:919)
    at CompileMetadataResolver._getDependenciesMetadata (J:\Java\workstation\front\.server\server.js:2665:25829)
    at CompileMetadataResolver._getTypeMetadata (J:\Java\workstation\front\.server\server.js:2665:23935)
    at CompileMetadataResolver._getInjectableTypeMetadata (J:\Java\workstation\front\.server\server.js:2665:31300)
    at CompileMetadataResolver.getProviderMetadata (J:\Java\workstation\front\.server\server.js:2665:31593)
    at J:\Java\workstation\front\.server\server.js:2665:29171
    at Array.forEach (<anonymous>)

Version of Angular, ng-bootstrap, and Bootstrap:

webpack : ^4.0.0
angular": 6.0.0-rc.6, 
ng-bootstrap: ^2.0.0

Why i get this error?

maxokorokov added a commit to maxokorokov/ng-bootstrap that referenced this issue May 29, 2018
Refactor existing implementation of the focus trap: handle only inside clicks and tab navigation. It doesn't steal outside focus anymore

Fixes ng-bootstrap#2406
Fixes ng-bootstrap#2390
Fixes ng-bootstrap#2372 (one more time)
maxokorokov added a commit to maxokorokov/ng-bootstrap that referenced this issue May 29, 2018
Refactor existing implementation of the focus trap: handle only inside clicks and tab navigation. It doesn't steal outside focus anymore

Fixes ng-bootstrap#2406
Fixes ng-bootstrap#2390
Fixes ng-bootstrap#2372 (one more time)
@maxokorokov
Copy link
Member

Looks like constructor(@Inject(DOCUMENT) private _document: Document) is causing the issue.
Should have been constructor(@Inject(DOCUMENT) private _document: any) I guess.

Should be fixed in 2.1.0 as the line above was removed completely

@hadirsa
Copy link
Author

hadirsa commented May 29, 2018

Thanks @maxokorokov . Anything that i can help?

@pkozlowski-opensource
Copy link
Member

We could work-around it but ultimately it will be solved on the Angular side via angular/angular#24116

@Trapulo
Copy link

Trapulo commented May 31, 2018

so what is the angular 6.x version that is compatible with ng-bootstrap 2?

@pkozlowski-opensource pkozlowski-opensource added this to the 2.1.1 milestone Jun 1, 2018
@hadirsa hadirsa closed this as completed Jun 1, 2018
@hadirsa hadirsa reopened this Jun 1, 2018
@hadirsa
Copy link
Author

hadirsa commented Jun 1, 2018

My bad. Sorry about close. I reopened it

maxokorokov added a commit to maxokorokov/ng-bootstrap that referenced this issue Jun 4, 2018
Refactor existing implementation of the focus trap: handle only inside clicks and tab navigation. It doesn't steal outside focus anymore

Fixes ng-bootstrap#2406
Fixes ng-bootstrap#2390
Fixes ng-bootstrap#2372 (one more time)
maxokorokov added a commit that referenced this issue Jun 4, 2018
Refactor existing implementation of the focus trap: handle only inside clicks and tab navigation. It doesn't steal outside focus anymore

Closes #2419
Fixes #2406
Fixes #2390
Fixes #2372 (one more time)
@zestan12
Copy link

zestan12 commented Dec 5, 2019

can someone help me I'm seriously suffering I'm tired of this error
nativescript angular preview problem tns preview
ReferenceError: document is not defined
Bug description:
LOG from device Galaxy Grand Prime Pro: ERROR ReferenceError: document is not defined
LOG from device Galaxy Grand Prime Pro: ERROR CONTEXT {
LOG from device Galaxy Grand Prime Pro: "def": {
LOG from device Galaxy Grand Prime Pro: "nodeMatchedQueries": 0,
LOG from device Galaxy Grand Prime Pro: "flags": 0,
LOG from device Galaxy Grand Prime Pro: "rootNodeFlags": 33554433,
LOG from device Galaxy Grand Prime Pro: "nodeIndex": 0,
LOG from device Galaxy Grand Prime Pro: {
LOG from device Galaxy Grand Prime Pro: "nodes": [
LOG from device Galaxy Grand Prime Pro: "nodeFlags": 33603585,
LOG from device Galaxy Grand Prime Pro: "renderParent": null,
LOG from device Galaxy Grand Prime Pro: "parent": null,
LOG from device Galaxy Grand Prime Pro: "view": {
LOG from device Galaxy Grand Prime Pro: "bindingIndex": 0,
LOG from device Galaxy Grand Prime Pro: "outputIndex": 0,
LOG from device Galaxy Grand Prime Pro: "checkIndex": 0,
LOG from device Galaxy Grand Prime Pro: "flags": 33554433,
LOG from device Galaxy Grand Prime Pro: "directChildFlags": 49152,
LOG from device Galaxy Grand Prime Pro: "childFlags": 49152,
LOG from device Galaxy Grand Prime Pro: "childMatchedQueries": 0,
LOG from device Galaxy Grand Prime Pro: "matchedQueries": {},
LOG from device Galaxy Grand Prime Pro: "matchedQueryIds": 0,
LOG from device Galaxy Grand Prime Pro: "ngContentIndex": null,
LOG from device Galaxy Grand Prime Pro: "references": {},
LOG from device Galaxy Grand Prime Pro: "childCount": 1,
LOG from device Galaxy Grand Prime Pro: "bindings": [],
LOG from device Galaxy Grand Prime Pro: "bindingFlags": 0,
LOG from device Galaxy Grand Prime Pro: "element": {
LOG from device Galaxy Grand Prime Pro: "outputs": [],
LOG from device Galaxy Grand Prime Pro: "ns": "",
LOG from device Galaxy Grand Prime Pro: "name": "ns-app",
LOG from device Galaxy Grand Prime Pro: "attrs": [],
LOG from device Galaxy Grand Prime Pro: "template": null,
LOG from device Galaxy Grand Prime Pro: "componentProvider": {
LOG from device Galaxy Grand Prime Pro: "nodeIndex": 1,
LOG from device Galaxy Grand Prime Pro: "parent": "[Circular]",
LOG from device Galaxy Grand Prime Pro: "renderParent": "[Circular]",
LOG from device Galaxy Grand Prime Pro: "bindingIndex": 0,
LOG from device Galaxy Grand Prime Pro: ...

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

No branches or pull requests

5 participants