Ionic Dynamic List Divider

后端 未结 3 1800
一向
一向 2021-02-14 23:08

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:43

    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}}
            
        
    
    

提交回复
热议问题