wmluke/angular-flash

Support for alerting to multiple issues in one flash-alert

BrianHutchison opened this issue · 2 comments

This is somewhat similar to issue 10.

One use case I have now: when alerting to issues when submitting a form there may be a number of issues wrong. For example, a field might be missing, another field could be too long, another might have unicode chars where none were allowed, etc. My backend service sends an array of messages of this type that I want to alert the user to. I could see overloading to allow an array for the message, or worst-case I could build html into the message using paragraph tags or an unordered list, but I need some equivalent functionality.

I'm hoping this angular-flash can be extended for this use, or guidance on how to meet my requirements some other way.

jusx commented

Write a http interceptor that interprets your response. On failure, process and format your messages with anyway you need to fulfill your use case. i.e. build html with the array of error messages. You can then do a flash within this interceptor. This assuming your messaging and flashing is standard within your application.

IMHO this kind of functionality do not belong inside angular-flash.

Sorry for the delayed response...just got married and was on my honeymoon :-).

Anyway, I agree with @jusx, angular-flash is not the right layer for this. You should handle the error response within the controller or response interceptor.

Thanks for the feedback and good luck,
Luke