I have generated a JHipster project with version 4.9.0.
I am using the JhiAlertService to display various messages to users.
I would like to know how to send in parameters to indicate how long the messages are displayed.
JhiAlertService
comes from the ng-jhipster library.
You can view the code of alert.service.ts to see the available parameters.
For customizing the timeout, use the addAlert
method and pass it a JhiAlert
object containing a timeout
parameter:
this.alertService.addAlert({type: 'success', msg: 'A short message', timeout: 1000}, []);
Note that if you are using the i18n option, the msg
field is the name of the i18n JSON key, and the params
field should contain any information that is interpolated into the message. So for displaying an alert when the "Admin" user is saved successfully, you would use:
this.alertService.addAlert({type: 'success', msg: 'userManagement.updated', params: { param: 'admin' }, timeout: 1000}, []);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With