Answer the question
In order to leave comments, you need to log in
Why does JSON come to the client as an array of individual characters?
JSON is sent from the server to the client, but the client receives this:
0: "["
1: "{"
2: """
3: "I"
4: "d"
5: """
6: ":"
7: "1"
8: ","
9: """
10: "T"
11: "i"
12: "t"
13: "l"
14: "e"
15: """
16: ":"
17: """
...
180: "}"
181: "]"
$promise: d
$resolved: true
__proto__: g
'use strict';
/* Controllers */
angular.module('ipsub.controllers', [])
.controller('PreviewListController', ['$scope', '$rootScope', 'NewsFactory',
function ($scope, $location, NewsFactory) {
$scope.News = [];
NewsFactory.PreviewList.get(function (data) {
var a = data;
debugger;
});
}])
.controller('NewsEditCtrl', [function() {
}])
.controller('NewsDeleteCtrl', [function() {
}]);
/* Services */
var ipsubServices = angular.module('ipsubServices', ['ngResource']);
ipsubServices.factory('NewsFactory', function ($resource) {
return {
PreviewList: $resource('api/News/GetPreviewsList'),
News: $resource('api/News/GetNewsDetail/:id', { id: '@id' })
};
});
public class NewsController : ApiController
{
public NewsManager Nm = new NewsManager();
/// <summary>
/// Получение краткой информации о последнх 10 новостях объявлениях
/// </summary>
/// <returns></returns>
public string GetPreviewsList()
{
var result = new JavaScriptSerializer().Serialize(Nm.GetNewsList());
return result;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question