【发布时间】:2018-06-21 19:14:27
【问题描述】:
我最近将我的 Angular 项目从 4.2 版升级到了 6 版。一切都很好,除了我注意到 Angular 现在在发出发布请求时从我的 json 有效负载中删除了函数(这可能也发生在其他 http 选项中,但没有'没有检查他们)。除了 json.stringify 之外,有没有办法禁用此功能或解决方法?
这是我要发布的 json 有效负载:
{
name: "ghq_employeesTotal",
fieldMapping: ['item1'],
translation: ƒunction(val){ return val.toLowerCase()}
}
这是我在网络选项卡中看到的有效负载:
{
name: "ghq_employeesTotal",
fieldMapping: ['item1']
}
如您所见,它完全删除了我的翻译属性。
这是我发送帖子请求的函数:
public publishConfig(config): Observable<any>{
return this.http.post<any>(this.serviceURL + 'publish', config);
}
【问题讨论】: