c# - Uncaught TypeError: Cannot call method 'Where' of undefined -


i not sure cause of error trying return results using linq query statement loop through list of positions , loop users each of positions.

linq enumerable

var getlist = function () {         ajax.get({             url: ...,             datatosubmit: {id: properties.id },             datatype: "json",             onsuccess: function (roledata, status, jqxhr) {                 // bind role types                 bindmodel(roledata);                 console.log("roles:", roledata.length);                  ajax.get({                     url: ....,                     datatosubmit: { pagenumber: 1, id: properties.id },                     datatype: "json",                     onsuccess: function (userdata, status, jqxhr) {                         console.log("users", userdata.length);                         var results = linq.from(roledata.roletypes)                             .foreach(userdata.users)                             .where('x => x.contentrole == "' + roledata.contentrole + '"').any();                         console.log(results); }) }) 

error with:

var results = linq.from(roledata.roletypes)                                 .foreach(userdata.users)                                 .where('x => x.contentrole == "' + roledata.contentrole + '"').any(); 

error message: uncaught exception (js): uncaught typeerror: cannot call method 'where' of undefined

.where must getting bool predicate, passing string it. try change like

 .where(x => x.contentrole == roledata.contentrole); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -