-1

ng-repeat 내부에서 생성 된 html에 응답 데이터를 어떻게 동적으로 바인딩합니까?ng-repeat에서 html을 어떻게 바인딩합니까?

현재 모든 li에 대해 socialCount 만 바인딩됩니다. 이것이

<li ng-repeat="category in inbox.categories track by $index"> 
           <a href="#"> 
            <div class="left-row" ng-click="inbox.showView(category)" target="_self"> 
             <div class="leftcolumn1"><span class="glyphicon glyphicon-user"></span></div> 
             <div class="leftcolumn2">{{category}}</div> 
             <div class="leftcolumn3 email-time" ng-bind="inbox.messageCounts.socialCount"></div> 
            </div> 
           </a> 
          </li> 

내가 서버에서 얻을 응답 : 여기

내 HTML의

{"socialCount":431,"promotionsCount":17843,"updatesCount":26997,"forumsCount":1780} 

JS 기능 :

Inbox.prototype.getMessageCounts = 기능 (카테고리) {

$http.get(
this.messageCountUrl + this.userGuid).success(function(data){ 
    this.messageCounts=data; 
}.bind(this)); 
+0

질문이 명확하지 않은 경우,받은 편지함에 정확히 무엇이 있습니까? 그리고 당신은 정확하게 묶고 싶습니까? – yeswanth

+0

이 HTML 조각이 바인딩되어야합니다. 당신이 볼 수 있듯이 모든 루프 패스에는 socialCount 만 있습니다. 루프의 각 패스에 forumsCount, updatesCount 등이 필요합니다. – shashank

+0

카테고리에 대해 걱정할 필요가 없습니다. 제대로 작동하고 있습니다. 카운트가 제한되지 않고 있다는 것입니다. – shashank

답변

0

답변을 찾았습니까?

<div class="leftcolumn3 email-time" ng-bind="inbox.messageCounts.{{category|lowercase}}Count"></div> 
관련 문제