Ionic Dynamic List Divider

后端 未结 3 1973
悲哀的现实
悲哀的现实 2021-02-14 23:04

I have been stumped on this problem for a while now, so I am hoping you can get me in the right direction.

My angular factory returns an object which looks like this

3条回答
  •  被撕碎了的回忆
    2021-02-14 23:38

    This solution uses the ng-repeat alias feature to show a grouped date divider from a date object. The key to this solution is the ng-if on the divider. Note the parentheses around the date:'yyyy' filtered comparison, which only adds the divider to the DOM if the previous result year does not equal the current result year. It displays a grouped divider.

    
    
        
            {{results[$index].year|date:'yyyy'}}
        
    
        
            No semesters yet!
        
        
            
            
            {{semester.name}} {{semester.year}}
            
        
    
    

提交回复
热议问题