Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.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 html5哈希url_Angularjs_Google Api_Angularjs Routing - Fatal编程技术网

angularjs html5哈希url

angularjs html5哈希url,angularjs,google-api,angularjs-routing,Angularjs,Google Api,Angularjs Routing,我正在angular.js中使用服务器端google oauth 假设我的重定向url是localhost:8000/redirect。要删除我正在使用的angularjs中的# $locationProvider.html5Mode(true); 但是,当我访问url时,我得到一个错误: Error response Error code 404. Message: File not found. Error code explanation: 404 = Nothing matche

我正在angular.js中使用服务器端google oauth

假设我的重定向url是localhost:8000/redirect。要删除我正在使用的angularjs中的#

$locationProvider.html5Mode(true);
但是,当我访问url时,我得到一个错误:

Error response

Error code 404.

Message: File not found.

Error code explanation: 404 = Nothing matches the given URI.
但是,如果我手动键入url,即
localhost:8000/#redirect
,那么我会得到预期的结果,然后重定向到localhost:8000/redirect

我还尝试从谷歌应用程序控制台添加#。但是,这是不允许的


那么,如何完全删除散列呢

您在服务器端使用的是什么?在服务器端,您在任何情况下都应该返回布局html文件,在nodejs中是这样的:
app.get('*',function(req,res){res.sendfile('/views/layout.html');}
我使用的是angularjs分区,分区与“#”配合得很好