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
NgbOffcanvasRef and NgbModalRef should expose a ComponentRef #4688
Comments
I agree that it's not clean setting inputs programmatically on the modal component. OTOH, I've always wondered why the examples in the documentation decorate the properties set by the opening component with I generally expose an In your stackblitz, you could replace the inputs by regular writable signals. |
Sure, that works in this example. I'm trying to share the content components and do things like opening a popover on desktop and offcanvas on mobile. or modal/offcanvas |
I have the same problem. I hacked it for now. Hopefully the componentRef will be exposed soon so I can clean this up.
|
Bug description:
NgbOffcanvasRef and NgbModalRef should expose a ComponentRef when using a component type as content.
Currently the NgbOffcanvasRef exposes a componentInstance. This makes it hard to use components with Signal inputs, as you cannot do myComponentInstance.myProp = value. Instead, the proper way is to use the function setInput on a componentRef. setInput also triggers change detection and ngOnChanges correctly.
Link to minimally-working StackBlitz that reproduces the issue:
https://stackblitz.com/edit/angular-5zsark-l3yj9i
Versions of Angular, ng-bootstrap and Bootstrap:
Angular: 17.3.1
ng-bootstrap: 16.0.0
Bootstrap: 5.3.3
The text was updated successfully, but these errors were encountered: