0

我有一个ModalDirective来自ngx-bootstrap1.9.3 的版本并且正在使用 Angular 4。当show()在服务器端执行代码时调用(我使用的是 Angular Universal),我得到以下异常:

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)

代码不是为支持 Angular Universal 而构建的,还是我需要做些什么才能使其正常工作?

4

1 回答 1

1

请将 ngx-bootstrap 更新到 2.0.0-beta.8,它支持 Angular Universal。

于 2017-11-21T10:20:12.803 回答