Nice programing

ng-repeat를 사용하여 AngularJS에서 맵 항목을 반복하는 방법

nicepro 2020. 11. 10. 22:15
반응형

ng-repeat를 사용하여 AngularJS에서 맵 항목을 반복하는 방법


항목 키와 값을 모두 인쇄 할 수 있도록 맵의 항목을 어떻게 반복 하시겠습니까? 예를 들어 다음과 같이하고 싶습니다.

<ul>
    <li ng-repeat='mapEntry in {"First Name":"John", "Last Name":"Smith"}'>
        <span>Key: {{mapEntry.key}}, value: {{mapEntry.value}}</span>
    </li>
</ul>

문서 에서이 구문이 작동 한다는 것을 알았습니다.

<ul>
    <li ng-repeat='(key, value) in {"First Name":"John", "Last Name":"Smith"}'>
        <span>Key: {{key}}, value: {{value}}</span>
    </li>
</ul>

참고 URL : https://stackoverflow.com/questions/14704147/how-to-use-ng-repeat-to-iterate-over-map-entries-in-angularjs

반응형