2016-08-22 4 views
1

"프로덕션"에서 테스트 할 웹 사이트를 방금 배포했지만 웹 사이트로 이동하려고하면 일부 컴퓨터에서 내 ng-repeat 결과가 표시되지 않습니다. 어떤 사람들은 보게 될 것이다. 아무 것도 표시되지 않을 때 웹 사이트로 이동하면 소스 코드를보고 배열의 각 객체와 함께 ng-repeat를 볼 수 있지만 화면에는 HTML 출력이 표시되지 않습니다. 여기에 내 코드의 일부는 내 컨트롤러를로드 할 때 :

/** 
* Function that send a request to get a list of posts. 
* @return {Function} A promise. 
*/ 
function retrievePosts() { 
    var defered = $q.defer(); 
    // If the user is logged in we do a search by country, otherwise we get all the posts. 
    if($rootScope.user !== null && $rootScope.user !== undefined) { 
     PostService.searchPost({ countries: [$rootScope.user.country] }, function(err, posts) { 
      if(err) { 
       defered.reject(err); 
      } 
      else if(posts && posts.length > 0) { 
       defered.resolve(posts); 
      } 
      // If the previous condition is not true, we try to get all the posts, since the search by country didn't work. 
      else { 

       PostService.getAllPosts(function(err, posts2) { 
        if(err) { 
         defered.reject(err); 
        } else { 
         defered.resolve(posts2); 
        } 
       }); 
      } 
     }); 

    } else { 
     PostService.getAllPosts(function(err, posts) { 
      if(err) { 
       defered.reject(err); 
      } 
      else { 
       defered.resolve(posts); 
      } 
     }); 
    } 
    return defered.promise; 
} 

이 기능은 게시물 객체를 JSON의 배열을 가져 오는 데 사용됩니다. 그럼이 같은 q.all을 수행

$q.all([retrieveManufacturer(), retrieveCategories(), retrievePosts(), getTotalPosts(), retrieveGalleryPosts()]).then(function(results) { 
    $scope.manufacturers = results[0]; 
    $scope.categories = results[1]; 

    // Here we must cache the result and slice it, so that angular doesn't render 
    // a tone of post but 10 at a time. 
    postCache = results[2]; 
    $scope.numberOfPostsToShow = 10; 
    $scope.posts = postCache.slice(0, $scope.numberOfPostsToShow); 

    // Some code to display the proper amount of post for each category. 
    var i = -1; 
    var max = results[3].length; 
    var groupedPostsCount = { }; 
    var group; 

    while(++i < max) { 
     group = results[3][i]; 

     // "_id" contains the name of the category. 
     groupedPostsCount[group._id] = group.count; 
    } 

    if(Object.keys(groupedPostsCount).length > 0){ 
     $scope.categoriesPostCount = groupedPostsCount; 
    } 

    $scope.galleryPosts = results[4]; 

    // Prepare the $scope.galleryPosts to be bound with posts. 
    buildGallery($scope.galleryPosts); 

}, function(err) { 
    console.log(err); 
}); 

$의 q.all의 모든 작업이 실행됩니다 그들은 모두 해결하세요. 나는 범주, 제조사, 등등처럼 내 HTML에서 그들을 볼 수 있습니다 ... 게시물의 배열 아르 결과 [2] 그들은 실제로 그들에 500 게시물을 가지고 null이 아닙니다. 나는 $ scope를 호출하려고한다. $ apply()는 buildGallery() 메소드 호출 이후에 실행되지만 아무것도 작동하지 않는다. 내 html에 {{posts}}를 인쇄하면 게시물 배열을 볼 수 있습니다. 그들이 그 NG 반복에 때 : 물론

<div class="ad-container" ng-repeat="post in posts" ng-click="viewPostDetails(post)"> 
        <div class="ad-picture"> 
         <table class="wrapper"> 
          <tr> 
           <td><img ng-src="img/175/{{ post.mainImageName || post.imgUrls[0] }}" alt="No image provided"/></td> 
          </tr> 
         </table> 
        </div> 
        <div class="ad-info"> 
         <span class="ad-info-title">{{ post.title }}</span> 
         <span class="ad-info-price">{{ post.country == 'Canada' ? (post.price | currency : "CA$") : (post.price | currency : "US$") }}</span> 

         <br /> 
         <span>{{ post.country }}, {{ post.province }}, {{ post.createdAt | date }}</span> 

         <p>{{ post.description }}</p> 
        </div> 
       </div> 

이 코드는 내가 정말 이상해 말했다 보라구 수밖에 컨트롤러를 가지고 사업부 안에 있습니다. 내 개발 컴퓨터에서 모든 것이 완벽하게 작동하지만 내 친구의 컴퓨터 중 일부는 작동했고 다른 컴퓨터는 작동하지 않았습니다. 다음은 웹 사이트 www.firearmsbin.com에 대한 링크입니다. 아마도 컴퓨터에 문제가 발생할 것입니다. 나는 firefox, firefox, dev, edge, chrome 및 IE11을 시도했다.

감사합니다.

답변

0

"광고 컨테이너"클래스로 내 div를 표시하지 않는 사람이 있다는 것을 알았습니다. 그래서 "광고"단어가 들어있는 CSS의 모든 수업은 차단됩니다.

관련 문제