小编Nan*_*ano的帖子

如何使用Angular-CLI重写反向代理中的路径?

我已经使用angular2 CLI设置了反向代理,如下所示:

{
  "/api/customer/*": {
    "target": "http://localhost:9010",
    "secure": false
  }
}
Run Code Online (Sandbox Code Playgroud)

我的问题是远程API在路径/客户上公开服务,但反向代理发送的请求在/ api/customer上.

有没有办法从反向代理发送的请求中删除/ api?(不要回答"只需从你的http请求中删除/ api",因为我在/ customer上有一个有角度的路由).

谢谢,

纳米

proxy angular-cli angular

7
推荐指数
1
解决办法
6923
查看次数

用纯JavaScript覆盖全局CSS

我有以下情况:

.my-nice-class {
  max-width: 90%;
  max-height: 90%;
}
Run Code Online (Sandbox Code Playgroud)

此代码位于<style>...</style>html页面的第一行。我想通过设置例如下面示例中的新属性值来覆盖此全局css:

.my-nice-class {
  max-width: 40%;
  max-height: 40%;
}
Run Code Online (Sandbox Code Playgroud)

如何使用纯Javascript完成此操作?

谢谢你们,

奈米

html javascript css

5
推荐指数
1
解决办法
7644
查看次数

标签 统计

angular ×1

angular-cli ×1

css ×1

html ×1

javascript ×1

proxy ×1