0
public int Order { get; set; } 
     public string Name { get; set; } 
     public string NameCode { get; set; } 
     public string NextSectionCode { get; set; } 
     public IEnumerable<string> AddText { get; set; } 
     public IEnumerable<string> Languages { get; set; } 
     public string TemplateUrl { get; set; } 
     public string SummaryTemplateUrl { get; set; } 
     public string TypeCode { get; set; } 
     public int Min { get; set; } 
     public int Max { get; set; } 
     public string AddendumName { get; set; } 
     public string AddendumDescription { get; set; } 
     public bool DisplayOnly { get; set; } 
     public ValidationConfiguration Validation { get; set; } 
     public IDictionary<string, SectionConfiguration> Subsections { get; set; }- My service class 

내가 컨트롤러에서 NG 반복과 함께 HTML 파일을 사용하고

agreementApiSvc.getAllWizardSections($scope.agreement.Id).then(function (response) { 
 
      $scope.sections = response.data; 
 
      var i = 0; 
 
      angular.forEach($scope.sections, function (section) { 
 
       if (!section.DisplayOnly) { 
 

 
        section.Index = i; 
 
        i++; 
 
       } 
 
       if (section.SummaryTemplateUrl) { 
 
        $scope.$watch(function() { return section.IsLoaded === true; }, function() { 
 
         $scope.sectionsLoaded++; 
 
         
 

 
<!-- begin snippet: js hide: false console: true babel: false -->

<div ng-repeat="section in sections | orderBy: Order"> 
      <agreement-summary-section id="agreement-summary-section-{{$index}}-{{section.NameCode}}" section="section" ng-disabled="isDisabled" enabled-in-amend-mode="enabledInAmendMode && !isUnderReview" agreement-status="currentAmendmentStatus" 
       check-agreement-validity="checkAgreementValidity" is-enabled-in-name-change-mode="isEnabledInNameChangeMode" company-staging-status-progress="companyStagingStatusProgress"/> 
     </div> 

반복으로 HTML 파일과 각 반복을 사용하는 경우 고유 ID 년대를 만드는 방법 html 페이지를 "TemplateUrl"로 ... 잘 작동하지만 HTML 파일의 ID가 반복되므로이 문제를 극복 할 수 있습니다.

+1

에 오신 것을 환영합니다. 지금까지 해 온 일을 보여 주셔야합니다. –

+0

@AxelIsouard는 내 코드를 추가했습니다. –

+0

@Rajiv Bansal : 편집하기 전에 제 답변을 게시했습니다. 지침 : – Jigar7521

답변

0

(function(angular) { 
 
    'use strict'; 
 
angular.module('ngRepeat', []).controller('repeatController', function($scope) { 
 
    $scope.friends = [ 
 
    {name:'John', age:25, gender:'boy'}, 
 
    {name:'Jessie', age:30, gender:'girl'}, 
 
    {name:'Johanna', age:28, gender:'girl'}, 
 
    {name:'Joy', age:15, gender:'girl'}, 
 
    {name:'Mary', age:28, gender:'girl'}, 
 
    {name:'Peter', age:95, gender:'boy'}, 
 
    {name:'Sebastian', age:50, gender:'boy'}, 
 
    {name:'Erika', age:27, gender:'girl'}, 
 
    {name:'Patrick', age:40, gender:'boy'}, 
 
    {name:'Samantha', age:60, gender:'girl'} 
 
    ]; 
 
}); 
 
})(window.angular);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js"></script> 
 
</head> 
 
<body ng-app="ngRepeat"> 
 
    <div ng-controller="repeatController"> 
 
    I have {{friends.length}} friends. They are: 
 
    
 
    <ul class="example-animate-container"> 
 
    <li class="animate-repeat" ng-repeat="friend in friends"> 
 
     [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old. 
 
    </li> 
 
    <li class="animate-repeat" ng-if="results.length === 0"> 
 
     <strong>No results found...</strong> 
 
    </li> 
 
    </ul> 
 
</div> 
 
</body> 
 
</html>
에 StackOverflow에

+0

$ index를 사용했지만 html 페이지를 언급하지 않을 때만 사용할 수 있습니다 .... 여기 html로 ng-repeat를 사용하고 있습니다. –

+0

이렇게하려면 $ index로 트랙을 사용할 수 있습니다. – Jigar7521

+0

색인 만이 여기에서 작동하지 않습니다. 또한 스 니펫을 게시 할 수 있습니까 –