Matched row come first in table how, in Angularjs1?

Feb 3 2018 11:06 AM
Im using Smart table i want to keep matched rows on top of other rows in table using angularjs(1), in my case i have been matching string from table Cell, on the basis of matched string I'm changing row background color,once the row turns to colored row it should disply on top of the other normal rows, so that I'm able see matched rows instantly. how i can achieve this.
my code
  1. <tbody>  
  2. <tr ng-repeat="std in students" ng-style="set_color(std)">  
  3. <td>{{std.Name}}</td>  
  4. <td>{{std.ClassName}}</td>  
  5. <td>{{std.RollNo}}</td>  
  6. <td>{{std.Email}}</td>  
  7. </tr>  
  8. </tbody>  
Controller:
  1. $scope.set_color = function (std) {  
  2. var inputString = std.Name;  
  3. for (i = 0; i < inputString.length; i++)  
  4. {  
  5. var findme = "Olekar";  
  6. if (inputString.indexOf(findme) > -1)  
  7. {  
  8. return {'background-color':'#FFCCCB'}  
  9. }  
  10. }  
  11. }  

Answers (1)