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
Feature request: expose componentRef in NgbModalRef #4664
Comments
I came here, because of using signal inputs. At least in their current form those inputs are simply not updateable via the normal component class instance. They are not pure signals, so
So for anyone starting to use signal inputs or in the future maybe starting projects only with signal inputs, the modals would not allow input updates. Hoping this feature makes it through, maybe even without breaking changes 🙏 |
Bug description:
When using
NgbModal
, we can access thecomponentInstance
from theNgbModalRef
instance.Since the introduction of the new
setInput
method in Angular, I think it could be interesting to expose thecomponentRef
as well.For example, in the
NgbModal
documentation, we can see this example:The problem with this example is that when we set the
name
input on the component instance, it does not trigger any change detection.It's not a big issue with this trivial example, as the change detection will be triggered anyway, but it also means setting the
name
input like this cannot use the@Input
transform function and it would had to be done manually.What I'm suggesting is using the
setInput
method by exposing thecomponentRef
.Here is what it could look like:
Let me know what you think: the change seems small, I can work on a PR if it has some interests.
Link to minimally-working StackBlitz that reproduces the issue:
Not an issue per se, more a feature request :)
Versions of Angular, ng-bootstrap and Bootstrap:
Angular: N/A
ng-bootstrap: ^16.0.0
Bootstrap: N/A
The text was updated successfully, but these errors were encountered: