반응형
AngularJs ng-repeat orderBy date가 작동하지 않음
내림차순으로 주문하고 싶은 ng-repeat이 있습니다(최신품부터 주문).
하지만 잘 안 될 것 같아요.견적서 등을 다시 확인했습니다.난 시도했다.orderBy:'createdate':reverse
,orderBy:'article.createdate':reverse
,그리고.orderBy:'data.blog.article.createdate':reverse
아무도 작동하지 않는 것 같다.
제 견해는 이렇습니다.
<article data-ng-if="article.id == post || post===NULL" data-ng-repeat="article in data.blog.article | orderBy:'createdate':reverse | slice:currentPage*pageSize:currentPage+1*pageSize">
<h2 class="blog-post-title">
<a href="#!/blog/{{article.id}}" title="Permalink to {{article.title.__cdata}}">{{article.title.__cdata}}</a>
</h2>
<span class="blog-post-meta">Posted on {{article.createdate | date:'MMMM dd, yyyy h:mma'}} by {{article.author}}</span>
<div class="blog-post-content" ng-bind-html="article.content.__cdata">{{article.content.__cdata}}</div>
</article>
다음으로 데이터(X2J를 사용하여 XML에서 JSON으로 변환)의 예를 나타냅니다.
{
"blog": {
"article": [
{
"id": "1",
"author": "eat-sleep-code",
"title": {
"__cdata": "The first article."
},
"content": {
"__cdata": "\n This is my first article in my test site.\n "
},
"createdate": "2014-05-09"
},
{
"id": "2",
"author": "eat-sleep-code",
"title": {
"__cdata": "The second article."
},
"content": {
"__cdata": "\n This is my second article in my test site. This article's create date is actually earlier.\n "
},
"createdate": "2014-05-08"
}
]
}
}
그reverse
인수는 부울값이어야 합니다.
컨트롤러의 어딘가에서 true 또는 false로 역설정이 되어 있지 않은 경우,
orderBy:'createdate':reverse
와 함께
orderBy:'createdate':true
언급URL : https://stackoverflow.com/questions/24048590/angularjs-ng-repeat-orderby-date-not-working
반응형
'programing' 카테고리의 다른 글
예쁜이 사용 안 함Photo WordPress (Visual Composer (0) | 2023.04.05 |
---|---|
Python 2.5에서 사용할 수 있는 JSON 모듈은 무엇입니까? (0) | 2023.04.05 |
JavaScript 데이터 포맷 / 예쁜 프린터 (0) | 2023.04.05 |
Python에서 AJAX용 최소 서버를 구현하는 방법은 무엇입니까? (0) | 2023.04.05 |
API 인증 고안 (0) | 2023.04.05 |