【发布时间】:2017-11-09 00:00:00
【问题描述】:
我的 angularJs 函数在 Json 中返回响应,但我无法从中获取“模型”部分。
下面是我的代码:
this.search = function () {
var response = $http({
method: 'GET',
url: '/api/TalentPool/Search'
});
return response;
}
this.search().then(function (response) {
console.log('conscole: ' + response.data.model)
})
this.search().then(function (response) {
console.log(response.data.model)
})
下面是我的mvc方法:`
List<CandidateSearchViewModel> output = CRBuilderObj.ContructResultsViewModel(data);
CandidateSearch.model = output;
CandidateSearch.baseCriteria = criteria;
return Ok(CandidateSearch);
【问题讨论】:
-
你在哪里得到承诺
-
你不能这样返回
response。 Read the documentation. -
您可能是对的,但我已经看到了那个帖子,但无法找到解决方案。
-
你在哪里解决承诺?
.then()在哪里,看这个example fiddle
标签: angularjs json asp.net-mvc