Guest User

Untitled

a guest
Apr 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <select ng-model="$ctrl.type">
  2. <option value="">All</option>
  3. <option value="1">1</option>
  4. <option value="2">2</option>
  5. <option value="3">3</option>
  6. </select>
  7.  
  8. <tbody>
  9. <tr ng-repeat="rows in $ctrl.myData | filter: {Type: $ctrl.type} track by $index">
  10. <td>
  11. <span>{{rows.Type}}</span>
  12. </td>
  13. <td>
  14. <span ng-repeat="row in rows.Names track by $index">{{rows.Names[$index]}}</span>
  15. </td>
  16. </tr>
  17. </tbody>
  18.  
  19. myData = [
  20. {Type: "1", SiteId: 8, SiteName: "aaa"},
  21. {Type: "1", SiteId: 7, SiteName: "asb"},
  22. {Type: "2", SiteId: 1, SiteName: "aaa"},
  23. {Type: "1", SiteId: 17, SiteName: "x"},
  24. {Type: "2", SiteId: 7, SiteName: "xx"}
  25. ];
  26.  
  27. <tbody>
  28. <div ng-if="$ctrl.myData.filter(s => s.Type == $ctrl.type).length > 0">
  29. <tr ng-repeat=...>
  30. ...
  31. </tr>
  32. </div>
  33. <div ng-if="$ctrl.myData.filter(s => s.Type == $ctrl.type).length == 0">
  34. NO DATA FOR THIS OPTION
  35. </div>
  36. </tbody>
Add Comment
Please, Sign In to add comment