Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.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
Angularjs 无散列的角度路由问题_Angularjs_Router - Fatal编程技术网

Angularjs 无散列的角度路由问题

Angularjs 无散列的角度路由问题,angularjs,router,Angularjs,Router,我面临不使用“#”的角度布线问题 $locationProvider.html5Mode(true); 第一次加载时,没有#的路由工作正常,但刷新(F5)页面时,角度路由出现问题。请建议除服务器端Url重写之外的任何解决方案。您需要更改文件的服务方式。如果您使用的是webpack dev server,则需要添加以下内容(请参阅): 如果您使用的是nginx,则需要更改其服务文件的方式: location / { try_files $uri /index.html; } “请建议除服

我面临不使用“#”的角度布线问题

$locationProvider.html5Mode(true);


第一次加载时,没有#的路由工作正常,但刷新(F5)页面时,角度路由出现问题。请建议除服务器端Url重写之外的任何解决方案。

您需要更改文件的服务方式。如果您使用的是webpack dev server,则需要添加以下内容(请参阅):

如果您使用的是nginx,则需要更改其服务文件的方式:

location / {
  try_files $uri /index.html;
} 

“请建议除服务器端Url重写之外的任何解决方案”您解决了这个问题吗?
location / {
  try_files $uri /index.html;
}