maximelafarie / ngx-smart-modal

Modal/Dialog component crafted for Angular (Ivy-compatible)
https://maximelafarie.com/ngx-smart-modal/
MIT License
323 stars 87 forks source link

getModalData should return observable #308

Closed kpogorze closed 2 months ago

kpogorze commented 3 years ago

I'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

getModalData returns plain js object.

Expected behavior

It should return observable that emits modal data whenever setModalData is called with given modal id

What is the motivation / use case for changing the behavior?

Better user experience when using modal data inside modal components. Now you need to subscribe on one of modal events to get modal data if it has been set after modal component has been created.

Using observables would remove this sort of temporal dependencies between component that sets the data and the modal. To use data in components only async pipe or subscribe and any changes would be applied automatically. It would also make composing data and modal events easier.

Please tell us about your environment:

maximelafarie commented 3 years ago

Hi @kpogorze, I completely agree with you and observables are way more interesting to manipulate than plain objects. Since it'll be a BC, I put it in next major release.

🖖