Pass data to ViewRef resulting from TemplateRef content
See original GitHub issueI’m submitting a … (check one with “x”)
[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter
Current behavior
Currently, there’s no way to set the context of the view when passing a TemplateRef to NgxSmartModalService.create
.
Expected behavior The context of the ViewRef should be sync with the data of the modal.
Reproduction of the problem Example use case here: https://stackblitz.com/edit/ngx-smart-modal-example-4vbtak
What is the motivation / use case for changing the behavior?
I need this because I cannot scope the ngx-smart-modal
component inside the part of the component that have access to my data, and that is refreshed regularly. So, I need to be able to inject data from anywhere, in a template, and use let-foo
to get the foo
context property.
Please tell us about your environment: In a poor condition 🌲 🔥
-
Smart Modal version: 7.3.0
-
Angular version: 8.2.13
-
Browser: all
-
Language: TypeScript
Possible implementation
Setting the context of the EmbeddedViewRef created in NgxSmartModalService works (I just tried). So the EmbeddedViewRef reference should be stored somewhere to be reused when calling NgxSmartModalService.setData
.
I can PR 🍻
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top GitHub Comments
Can you try again locally with the latest version of master please. @maximelafarie fixed this problem I think
I found a way of doing what I want using the new examples mentioned above. But I still think setting arbitrary context can be useful.