Home ng-repeat highlight all rows but also deselect, select
Reply: 0

ng-repeat highlight all rows but also deselect, select

user6228 Published in September 21, 2018, 8:04 am

I have a basic html table where i need to have all the rows initially highlighted when the table is created. Also, if the user clicks the row it un highlights and clicked again highlights.

I have the click on a row, and it highlights. If you click again it un highlights. I just need to initially highlight all rows possibly by ng-repeat. It also needs to release the highlighting when the row is clicked again and then highlight back. userData is just a line of text for each row


<table class="superusertable" cellpadding="5" cellspacing="0">
  <tbody class="table-font">
  <tr ng-init="" ng-repeat="source in userData" 
                 ng-class="{'sourcesSelected': source.sourcesSelected}" 
  <td width="290px">
 <div class="action-checkbox"; width="290px">{{source.fromSourceID}}


 $scope.select = function(item) {
    item.sourcesSelected ? item.sourcesSelected = false : item.sourcesSelected = true;
share|improve this question
  • Not sure what your question is but your code is really verbose and confusing. Just write item.sourcesSelected = !item.sourcesSelected; – Aluan Haddad Feb 13 at 14:45

2 Answers 2

active oldest votes
up vote 1 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.319148 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO