问题描述
在以下情况下,我无法发送“ id”。
例如:url = somedomain/{id}/emp
为此,我将proxy.config.json文件中的网址设置为
"/employee": {
"target":"somedomain","secure":false,"pathReWrite: {
"/employee":""
}
}
现在在我称为Angular Service文件中
this.http.post(`http://localhost:4200/employee/{id}/emp`);
在这种情况下,总URL仅替换为/ employee。但是我想通过proxy.config.js文件动态发送“ id”。您能帮我解决这个问题吗?预先感谢。
解决方法
我猜你有错字。
用W
中的w
替换大写字母pathReWrite
:
should be w
\/
"pathReWrite: {
"/employee":""
}