Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.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路由(客户端)?_Angularjs_Node.js_Html_Routing_Loopbackjs - Fatal编程技术网

Angularjs 如何在环回上设置html5路由(客户端)?

Angularjs 如何在环回上设置html5路由(客户端)?,angularjs,node.js,html,routing,loopbackjs,Angularjs,Node.js,Html,Routing,Loopbackjs,对于前端路由,我应该在middleware.json(loopback)中编写什么来操作html5模式 我可以使用类似于: app.all(“/*”,…)并返回my index.html 但这种解决方案不利于环回。我可以覆盖middleware.json路由。 因此,我需要一些解决方案,如何在middleware.json中配置它。这是从文档中获取的,在您点击/时,他们会在其中添加一个root.js路由,以服务于API的正常运行时间。只需将其更改为服务于AngularJS index.html即

对于前端路由,我应该在middleware.json(loopback)中编写什么来操作html5模式

我可以使用类似于:
app.all(“/*”,…)并返回my index.html
但这种解决方案不利于环回。我可以覆盖middleware.json路由。

因此,我需要一些解决方案,如何在middleware.json中配置它。这是从文档中获取的,在您点击
/
时,他们会在其中添加一个root.js路由,以服务于API的正常运行时间。只需将其更改为服务于AngularJS index.html即可

module.exports = function(server) {
  var router = server.loopback.Router();
  // could also use function that dynamically creates index.html, etc...

  router.get('/', <SEND index.html HERE>);

  server.use(router);
};
...
  "files": {
    "loopback#static": {
      "params": "$!../client"
    }
  },
...