javascript - Return list to JSON to Angularjs -
it such must have sent content controller on angularjs shall come forth words such l in or e, goes in other words, of words let words sign has single letter.
there no fault forward console , believe problem not specify value side.
i have try here:
a circular reference detected while serializing object of type 'subsonic.schema .databasecolumn'.
load.js
var app = angular.module('wordspreads',[]); app.controller('wordspreadslistvalue', function ($scope, $http) { $http( { method: 'get', url: '../profile/mwordspreads' }).success(function (response) { $scope.entries = data.list;; }); console.log("test");//it not appear in console log. });
controller:
[httpget] public jsonresult mwordspreads() { wordsspreadslistvalue model = new wordsspreadslistvalue(); var db = helpertotables.dbvalue; model.list = db.wordspreads.tolist(); return json(model.list, jsonrequestbehavior.allowget); }
model:
public class wordsspreadslistvalue { public list<wordspread> list { get; set; } }
error giv me:
a circular reference detected while serializing object of type 'xxsitename.models.linqdatabase.wordspread'
update:
model.list = db.wordspreads.select(x => new { name = x.name, textvalue = x.text.tostring() }).tolist();
error :
cannot implicitly convert type 'system.collections.generic.list<>' 'system.collections.generic.list' mvcordklar2015
.
model.list = db.wordspreads.select(x => new { prop1 = x.1, prop2 = x.2}).tolist();
you having trouble serializing model.list
, json serialize barfing on serializing model.list. if make new object without navigation properties fine.
in experience has navigation properties, dont understand is. but, once remove navigation properties equation work.
Comments
Post a Comment