ng-bootstrap / ng-bootstrap

Angular powered Bootstrap

Home Page:https://ng-bootstrap.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect injector in offcanvas components

dkaczor97 opened this issue · comments

Bug description:

This issue has already been addressed in case of modals - #4447
My lazy loaded module provides a service and defines a component. I want to use that component as content of offcanvas. If I try to inject said service in that component I get NullInjectorError.
I've checked the source code and I think offcanvas-stack.ts needs the same fix as modal-stack.ts

Link to minimally-working StackBlitz that reproduces the issue:

https://stackblitz.com/edit/angular-oehcjx?devToolsHeight=33
Click the button and check console

Versions of Angular, ng-bootstrap and Bootstrap:

Angular: 16.0.6

ng-bootstrap: 15.1.2

Bootstrap:

@dkaczor97 I'm not sure I understand the issue, the problem seems to be with ChildService, not with anything related to offcanvas.

Can you provide a minimal reproduction scenario, please? there are like 3 levels of routing... and if I just remove ChildService that is not connected to offcanvas - everything works fine.