-
Notifications
You must be signed in to change notification settings - Fork 93
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
onActionCallback feature request #27
Comments
This is certainly a very desirable type of behavior, but I do not believe that additional API expansion is needed. Such behavior can be added via Why is this more desirable than what you've described?
Unfortunately, there was a display bug in the toast icons that caused the icons to overlay the entire body. This has been corrected by commit 14f1286. In addition, i have added an additional use case to the https://github.com/Stabzs/Angular2-Toaster/tree/master/demo/systemjs demo to demonstrate how to use this type of component injection. True to the use case you describe above, it allows for state toggling and that state is outputted to the UI. Please review it and see if it meets your needs. The library has been updated to version |
Completely agree with your logic. This almost works for me... I am just missing a small piece of know-how. This is my class defined in a separate file:
How do I pass the input properties and listen to the events?
It seems like it would be nice to support BodyOutputType.Template as a bodyOutputType:
|
I've been spending some time thinking about how to handle this. I could be completely wrong, but my understanding of Angular 2 is that what you've described as a "Template" option is pretty much impossible. There's no such thing as an arbitrary I am currently exploring alternative ways to bind inputs and outputs to the rendered component. Keep in mind that this is more logic than was ever intended to live in a toast, but there still may be a reasonable way to handle it. You might be forced to use injected services to control your data however. I'll continue to look into ways to solve this more gracefully. |
I agree that this is putting toasts on steroids and it is a great opportunity to reduce the use of modal alert popups. Does something like this help? This project might hold some clues too: Otherwise, the original actions idea seems to be a viable alternative? Thanks again for a great project! |
Thanks for both links. The case you're describing is somewhat unique, since you want the ability to control inputs and outputs. In the first example, this only works if you have the same inputs/outputs to create every time, based on the same parameters. The second doesn't seem to be passing data via any sort of input/output context. So I don't think that's a good strategy. The original actions proposal still has the same problems I outline above. The largest issue of all is of course that there's no way to support future action expansion as needed since the responsibility lies in the wrong place. A possible solution would be a function callback that is used to register data. Another option might be a service that you inject into your component. I'll continue to play with the concept. |
How about adding a free-form data object? Something like this:
Then the component could be something like this:
|
In this case how would the data know to register the action emitter? In addition, is there a large difference between this and a shared service? |
You would register the listeners before passing it into the data structure. A shared service is cleaner for most situations though. The real challenge is getting dynamic data to the component. I see that you updated the example TestComponent4 to take dynamic data... but I am not sure where you actually provide the data based on different users making the request. That will totally solve the issue. :) |
@friksa apologies for letting this sit so long. After letting the Angular 2 community and changes bake in, it still seems like the best way to handle this would be a shared service. I'm open to any new insight if you have it. If not, I don't believe that this is something that can/should be enhanced within the library and instead should be handled via services. |
Changes to Component bodies in |
We are using this project as part of a web conferencing product. When you are busy teaching and someone makes a request to open their microphone, a modal popup message is very disruptive. Also, you may not want to open their microphone immediately... you may want to finish a thought before accepting their request.
Your toaster popup would be ideal if you could add an action button with a callback similar to onHideCallback. If the presenter clicks on the action button, then onActionCallback is fired and the microphone is opened. If the toast is dismissed, the request is ignored.
The API could be something like this:
We do not need more than 1 action, but you may want to consider it from the start and rather use this kind of an API:
The text was updated successfully, but these errors were encountered: