Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 使用Angular和Microsoft ASP.NET核心JavaScript服务SPA模板延迟加载模块_Asp.net Mvc_Angular - Fatal编程技术网

Asp.net mvc 使用Angular和Microsoft ASP.NET核心JavaScript服务SPA模板延迟加载模块

Asp.net mvc 使用Angular和Microsoft ASP.NET核心JavaScript服务SPA模板延迟加载模块,asp.net-mvc,angular,Asp.net Mvc,Angular,我在加载角度模块时遇到了一个问题 我在这里创建了一个Github回购: 我正在将Visual Studio 2017与Microsoft ASP.NET核心JavaScript服务SPATemplate一起用于Angular() 我正在尝试使用延迟加载实现添加用户模块,但是尽管语法正确,在Angular documented方法中概述的方法仍然不起作用 错误如下: ERROR Error: Uncaught (in promise): Error: Cannot find module 'app

我在加载角度模块时遇到了一个问题

我在这里创建了一个Github回购:

我正在将Visual Studio 2017与Microsoft ASP.NET核心JavaScript服务SPATemplate一起用于Angular()

我正在尝试使用延迟加载实现添加用户模块,但是尽管语法正确,在Angular documented方法中概述的方法仍然不起作用

错误如下:

ERROR Error: Uncaught (in promise): Error: Cannot find module 'app/user/user.module'. webpackEmptyContext@http://localhost:3258
[routerLink]="['/profile']" routerLinkActive="active">Welcome User
[routerLink]="['/user/profile']" routerLinkActive="active">Welcome User
user.module在app.module.shared.ts文件中引用:

{ path: 'user', loadChildren:'app/user/user.module#UsersModule'}
但是,即使尝试不同的路径字符串,这也不起作用

解决方法是放弃懒散加载,从navbar.component.html文件中的导航链接开始,将部分内容修改为以下内容:

ERROR Error: Uncaught (in promise): Error: Cannot find module 'app/user/user.module'. webpackEmptyContext@http://localhost:3258
[routerLink]="['/profile']" routerLinkActive="active">Welcome User
[routerLink]="['/user/profile']" routerLinkActive="active">Welcome User
然后将UserModule引用添加到app.module.shared.ts文件

这是可行的,但懒散的工作似乎没有发生

鉴于懒散的方法如下:

ERROR Error: Uncaught (in promise): Error: Cannot find module 'app/user/user.module'. webpackEmptyContext@http://localhost:3258
[routerLink]="['/profile']" routerLinkActive="active">Welcome User
[routerLink]="['/user/profile']" routerLinkActive="active">Welcome User
然后添加带有loadChildren语法的路径并删除UserModule,如app.module.shared.ts文件所示

有人碰到过这个吗