newbie newbie - 2 months ago 18
Java Question

Angularjs How to show hidden data from the selected row in a listBox?

i got something like this:

A table, with the data of more students...the content is ID, Name, LastName and i added a new class to the project...its called BankAccount

the students can have 0 or more accounts...

and i added them in a data-binding process to the students...

now i want to select a student, and to show his (if any) accounts in a listBox on the same far i have this code:

the table with the students...

<table border="1" name="tableStud" arrow-selector>
<td>First Name</td>
<td>Last Name</td>

<tr ng-repeat="student in result"
ng-class="{'selected':$index == selectedRow}"
<td>{{ }}</td>
<td>{{ student.firstname }}</td>
<td>{{ student.lastname }}</td>
<td>{{ student.mestorodjenja.ime }}</td>



<select ng-model="student.accounts" multiple="multiple"
ng-options=" for account in student.accounts track by"


In the controler i got this:

$scope.setSelected = function(student, index) {
$scope.student = student;
$scope.selectedRow = index;

Now the problem is, my list box is showing the accounts for the selected students....but they are all SELECTED and, once i press on one of them, the others disappear, while the pressed one is still selected....

On top of that, once i go on to another student, and come back...all the disappeared accounts from the listBox are still missing....and the old one is also selected...

In the end my question is:

Is it possible to just select the student, and his accounts to be shown on the listBox without being selected....and not disappearing after i press them...?

Thx in advance!


Just replace your varible for selected student. Like :

$scope.setSelected = function(student, index) {
   $scope.selectedstudent = student;   
   $scope.selectedRow = index;


 <select ng-model="student.accounts" multiple="multiple"
            ng-options=" for account in selectedstudent.accounts track by"