简体   繁体   English

Angular Toastr with Jhipster

[英]Angular Toastr with Jhipster

I'm working on a Jhipster project with angular 6, and I'm trying to write a code that appears when a certain event happens.我正在使用 angular 6 开发 Jhipster 项目,并且我正在尝试编写在某个事件发生时出现的代码。 I followed this step by step in a different application (a test), and it worked, but when I tried to use it in my project with Jhipster, the notification does not appear.. Does anyone know the right way to do it with jhipster?我在另一个应用程序(测试)中一步一步地按照这个步骤进行操作,并且它有效,但是当我尝试在我的 Jhipster 项目中使用它时,通知没有出现.. 有谁知道使用 jhipster 的正确方法?

I started working in this area a short time ago, and that's why I have doubts with Jhipster.我不久前开始在这个领域工作,这就是为什么我对 Jhipster 产生怀疑。

Jhipster version 0.5.4 , ngx-toastr 10.0.2 , Angular version 6.2.4 Jhipster 版本 0.5.4ngx-toastr 10.0.2Angular 版本 6.2.4

I followed this example: https://blog.jscrambler.com/how-to-create-angular-toastr-notifications/我按照这个例子: https://blog.jscrambler.com/how-to-create-angular-toastr-notifications/

When things don't appear it's usually because the css stylesheets are not included.当事情没有出现时,通常是因为不包括 css 样式表。

The tutorial you linked tells you to refer to toastr.css within styles section of angular.json .您链接的教程告诉您参考toastr.cssstyles部分中的angular.json This does not work with JHipster because it's not fully compatible with Angular CLI.这不适用于 JHipster,因为它与 Angular CLI 不完全兼容。

Read your project's README.md to learn about how to manage dependencies and styles.阅读您项目的README.md以了解如何管理依赖项和 styles。

Also, JHipster provides also its own toaster JhiAlertService which is already used to display success or error of API calls using an interceptor.此外,JHipster 还提供了自己的烤面包机JhiAlertService ,它已经用于显示使用拦截器调用 API 的成功或错误。 It could be enough for some users.对于某些用户来说,这可能就足够了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM