我想向我的API提交一个复杂的模型。模型包含对象和/或数组。使用HttpParams
,我可以提交简单的key, value
对象,如下所示:
let httpParams = new HttpParams()
.set('name','Foo')
.set('birth','');
如何设置复杂模型?这不起作用!
var actionData = {
model: { name:'Foo', birth:'2000-01-19 05:30:14T6' },
filters: [ {key1:value1}, {key2:value2} ]
};
let httpParams = new HttpParams()
.set('actionData', JSON.stringify(actionData));
没用!