0

I have a ModalDirective from ngx-bootstrap version 1.9.3 and am using Angular 4. When a call is made to show() when code is executing on the server side (I am using Angular Universal), I am getting the following exception:

Cannot read property 'body' of undefined
TypeError: Cannot read property 'body' of undefined
at ModalDirective.checkScrollbar (ClientApp\dist\main-server.js:49156:105)
at ModalDirective.show (ClientApp\dist\main-server.js:48977:14)
at ConfirmModalComponent.show (ClientApp\dist\main-server.js:48086:27)
at SafeSubscriber._error (ClientApp\dist\main-server.js:87270:41)
at SafeSubscriber.module.exports.SafeSubscriber.__tryOrUnsub (ClientApp\dist\vendor.js:574:16)
at SafeSubscriber.module.exports.SafeSubscriber.error (ClientApp\dist\vendor.js:533:26)
at Subscriber.module.exports.Subscriber._error (ClientApp\dist\vendor.js:464:26)
at Subscriber.module.exports.Subscriber.error (ClientApp\dist\vendor.js:438:18)
at MapSubscriber.module.exports.Subscriber._error (ClientApp\dist\vendor.js:464:26)
at MapSubscriber.module.exports.Subscriber.error (ClientApp\dist\vendor.js:438:18)

Is the code not built to support Angular Universal or is there something I need to do in order to get this working?

Matt
  • 1,446
  • 19
  • 17

1 Answers1

1

Please update ngx-bootstrap to 2.0.0-beta.8, it supports Angular Universal.

IlyaSurmay
  • 2,283
  • 12
  • 20
  • I already tried this and it has exactly the same issue: https://github.com/valor-software/ngx-bootstrap/blob/development/src/modal/modal.directive.ts#L399 – Matt Nov 21 '17 at 11:56
  • hmm, I don't see this error on our universal demo - https://ngx-universal.herokuapp.com/modals – IlyaSurmay Nov 21 '17 at 12:26
  • Could you create a repo with minimal reproduction? I'll reopen github issue then. – IlyaSurmay Nov 21 '17 at 12:27
  • Sure. I'll ping you when I have updated the question with a repo. – Matt Nov 21 '17 at 17:35