在将我的模型发布到服务以保存数据时,我收到以下错误,无法找出原因
Error: [$parse:syntax] Syntax Error: Token 'danger' is unexpected, expecting [:] at column 10 of the expression [{'alert-'danger'': true, 'alert-dismissable': closeable}] starting at [danger'': true, 'alert-dismissable': closeable}].这就是我为我的模型调用SAVE的方法
ContractsService.ContractHeader.save(this.contractHeaderModel,
angular.bind(this, function (data, headers) {
debugger;
icAlertService.successtoast("Contract saved successfully."); //ASM NLS
//this.goBack();
}),
function (error) {
});发布于 2014-11-25 03:25:39
您的服务器返回的任何内容都是非法的json:
[{'alert-'danger'': true, 'alert-dismissable': closeable}]只要看看这个,你就可以说出一些东西,因为在某些地方有一些没有意义的单引号。也许你的意思是:
[{'alert-\'danger\'': true, 'alert-dismissable': closeable}]]发布于 2014-11-26 00:27:37
在我将JSON对象传递给POST之前,通过添加如下内容解决了问题
{'expectedobjectname':objectToPost}
这就是服务期望接收数据的方式。
https://stackoverflow.com/questions/27112360
复制相似问题