I am not sure what could be the cause of this error but i am trying to return results using linq query like statement to loop through a list of positions and then another loop to get all users for each of the positions.
linq is 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 be getting a bool predicate, but you are passing a string to it. Try to change it to something like
.Where(x => x.ContentRole == roleData.ContentRole);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.