C# MVC AngularJS -


code:

[responsetype(typeof(list<myclass>))]  public async task<ihttpactionresult> get()  {      var userid = user.identity.name;      var obj = await this.findallasync(userid);       if (obj == null)      {          return this.notfound();      }       return this.ok(obj);  } 

it doesn't seem throw errors server side however, client side in angular controller 1 have ideas?

i had code as: responsetype(typeof(bool)] , since changing not work, returning list object not allowed or need in either angular js file or c# controller class work, e.g. json-fy it?!?!

refer http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/build-a-single-page-application-(spa)-with-aspnet-web-api-and-angularjs code base. have done change 1 of calls return list cannot see why different. have not modified client side controller class significance other upgrade code new syntax.

$http.get("/api/crosswordhelper").then(     function (response) {         //$scope.historyitems = data.userhistory;         $scope.title = "this app allows find of words in dictionary obey regular expression.";         $scope.working = false;     },     function (response) {         $scope.title = "oops... went wrong '" + response.statustext + "'";         $scope.working = false;     }); 

the application hangs moment (like 10 seconds) shows "oops ... " error message statustext of 'internal server error'. can tell call findallsync returns 1 row expect. not understand why need json'fy sugested in comment below when original code didn't.

sorry wasting everybody's time because found solution own problem - again dummies award. fact server halting every time render display turned light bulb on me.

even though result set list of objects has 1 item in list object contains internal list of 58,000+ rows!

so decided return needed purposes i.e. added [jsonignore] tag appropriate internal list field of class not need internal list brought client. gosh imagine if there more 1 item in list. anyhow response simultaneous now!


Comments

Popular posts from this blog

r - how do you merge two data frames the best way? -

How to debug "expected android.widget.TextView but found java.lang.string" in Android? -

php - mySQL problems with this code? -