Sam
Sam

Reputation: 103

AlertService directive in JHipster

I am using JHipster 3.3.0 and generated code using JDL.

Out of the box, each entity has its own popup dialog page for editing and saving data, i.e. {entity}-dialog.html. And after clicking the Save button, the dialog will close then the entity list page (i.e. {entity}s.html) will display the alert message 'A new <entity name> is created/updated with identifier {primary key}' to indicate outcome of save by using <jhi-alert-error></jhi-alert-error>.

Now I am implementing a one-to-many relationship for 2 entities, say User and Account(i.e. a User can have many Accounts) such that the editing and saving of both entities happen in the same User page(i.e. User-dialog.html).

All Accounts of the User are displayed in an Account table, each row of the table will have a Save button to save data of the Account after editing the data in the row.

This is all working fine. However, I noticed after clicking the Save button of Account row, I can see the background User list page displaying the alert message mentioned above rather then in the current page.

I can't figure out how to display the alert message in the current page as opposed in the entity list page, which is the default behavior.

I am missing some logic here. Any idea?

Basically, the <jhi-alert-error></jhi-alert-error> in my <entity>-dialog.html page is ignored and won't display message for outcome of successful save except for error message from Form validation.

Thanks in advance,

Sam

Upvotes: 2

Views: 4716

Answers (1)

Sam
Sam

Reputation: 103

Ooops,silly me. Just found the answer.

The alert message 'A new is created/updated with identifier {primary key}' was displayed because the tag <jhi-alert></jhi-alert> was used, it was never <jhi-alert-error></jhi-alert-error>.

Upvotes: 2

Related Questions