ASP.NET Boilerplate (Core 2.0 + Angular 5) 免费模板中的 Promise 错误 [英] Promise error in ASP.NET Boilerplate (Core 2.0 + Angular 5) Free Template

查看:25
本文介绍了ASP.NET Boilerplate (Core 2.0 + Angular 5) 免费模板中的 Promise 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 ASP.NET Boilerplate 通过 REST API 客户端(如 Postman 使用自定义 API)对数据库进行 CRUD 操作,到目前为止,它运行良好.

I have been using ASP.NET Boilerplate to do CRUD Operations with the database with a REST API client like Postman using custom APIs and so far , it's working quite well.

但是当我转到前端部分时,使用管理员帐户登录后,用户组件中出现未处理的异常.首先,我可以看到我添加的用户列表,从中我可以说CreateGet 操作运行正常(我还测试了编辑用户和它运作良好).当我进入Deleting"用户时,我可以看到控制台输出中的异常,如图所示:

But then when I move on to the frontend part, there is an unhandled exception in Users Component after logging in with an Admin account. First of all, I can see the list of users that I added, from which I can say the Create and Get operations are running properly (I also tested editing the users and it worked well). When I get to "Deleting" the users, I can see an exception in the console output as shown in the picture:

我以为我弄乱了一些代码,所以我重新下载了整个模板并重新开始再次执行删除操作.错误仍然存​​在.

I thought I had somehow messed up some of the codes, so I redownloaded the whole template and started freshly to performed the delete operation again. The error still persists.

此外,当我在 service-proxy.tx 中添加自己的服务类并将其导出到其 service-proxy.module.ts 中时,并注入该服务进入 app.componentconsole.log 构造函数中的响应,我仍然得到相同的异常.

Moreover, when I add my own service class in the service-proxies.tx and export it in its service-proxy.module.ts, and inject the service into the app.component and console.log the response in the constructor, I still get the same exception.

请帮我挖掘问题的根源.谢谢.

Please help me dig to the root of the problem. Thank you.

这是HTML行中的代码:50:

Here is the code in HTML line: 50:

<li>
    <a href="javascript:void(0);" class="waves-effect waves-block" (click)="delete(user)">
       <i class="material-icons">delete_sweep</i>{{l('Delete')}}</a>
</li>

在 TS 端,它使用 User DTO 调用 delete 函数.在 TS 端,delete(User) 看起来像:

On, the TS side, it is calling the delete function with User DTO. On the TS side, the delete(User) looks like:

protected delete(user: UserDto): void {
    abp.message.confirm(
        "Delete user '" + user.fullName + "'?",
        (result: boolean) => {
            if (result) {
                this._userService.delete(user.id)
                    .subscribe(() => {
                        abp.notify.info("Deleted User: " + user.fullName);
                        this.refresh();
                    });
            }
        }
    );
}

编辑 2:

我将 SweetAlert 版本从 1.1.3 升级到 2.0.8,应用程序甚至无法编译.根据一些 GitHub 线程,我应该覆盖一些与 SweetAlert 模块相关的功能.但是随后的错误消息说应用程序甚至找不到 .....node_modules\sweetalert\dist\sweetalert.css.js

推荐答案

ABPv3.2.0 有一些重大变化:

#2145 升级到 sweetalert v2.x.现有应用程序应将 sweetalert 包升级到 v2.x.

#2145 Upgrade to sweetalert v2.x. Existing applications should upgrade sweetalert packages to v2.x.

免费模板可能尚未升级.

The free template may not have upgraded that yet.

您可以升级到 SweetAlert v2.0.8.在使用 yarn 之前删除 node_modules 文件夹.

You can upgrade to SweetAlert v2.0.8. Remove the node_modules folder before using yarn.

您现在可以通过 SweetAlert 升级下载v3.4.1 模板.

You can now download v3.4.1 of the template with the SweetAlert upgrade.

这篇关于ASP.NET Boilerplate (Core 2.0 + Angular 5) 免费模板中的 Promise 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆