2013-10-07 4 views
0

이 오류의 원인이 무엇인지 모르겠지만 linq 쿼리와 같은 명령문을 사용하여 결과를 반환하려고 시도하고 있습니다. 각 위치에 대해 모든 사용자를 확보하십시오.Uncaught TypeError : 'Where'of undefined 메서드를 호출 할 수 없습니다.

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); 
}) 
}) 

오류입니다 :

var results = linq.From(roleData.RoleTypes) 
           .ForEach(userData.Users) 
           .Where('x => x.ContentRole == "' + roleData.ContentRole + '"').Any(); 

오류 메시지 : 캐치되지 않는 예외 (JS) : catch되지 않은 형식 오류 : '어디'정의되지 않은

+0

'linq.js'라고 생각하나요? –

+0

@GetArnold 네, 맞습니다. – Masriyah

답변

1
의 메소드를 호출 할 수 없습니다

. bool 술어를 가져와야하지만 문자열을 전달해야합니다.

.Where(x => x.ContentRole == roleData.ContentRole); 
+0

당신의 제안을 바꿨을 때 : '잡히지 않은 SyntaxError : 예기치 않은 토큰 =='과'잡히지 않은 TypeError : 객체 # 에는'Init'' 메서드가 없습니다. – Masriyah

+0

나는 그것을 볼 수 없었습니다. linq.js. 이것을보십시오 :'.Where (function (x) {return x.ContentRole == roleData.ContentRole})' – Anarion

+0

나는 처음 시작한 것과 같은 오류가 발생했습니다. '잡히지 않은 예외 (js) : 잡히지 않는 타입 오류 : 메서드를 호출 할 수 없습니다. '어디에'정의되지 않은'의 구조가 맞습니까? From, ForEach, Where - 반환해야 할 항목을 선택해야합니까? – Masriyah

관련 문제