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


i got this:

a table, data of more students...the content id, name, lastname , from.....now added new class project...its called bankaccount

the students can have 0 or more accounts...

and added them in data-binding process students...

now want select student, , show (if any) accounts in listbox on same page...so far have code:

the table students...

    <table border="1" name="tablestud" arrow-selector>         <tbody>             <tr>                 <td>id</td>                 <td>first name</td>                 <td>last name</td>                 <td>from</td>             </tr>              <tr ng-repeat="student in result"                 ng-class="{'selected':$index == selectedrow}"                 ng-click="setselected(student,$index)">                 <td>{{ student.id }}</td>                 <td>{{ student.firstname }}</td>                 <td>{{ student.lastname }}</td>                 <td>{{ student.mestorodjenja.ime }}</td>              </tr>          </tbody>     </table>    <select ng-model="student.accounts" multiple="multiple"                 ng-options="account.name account in student.accounts track account.id"          >         </select> 

in controler got this:

$scope.setselected = function(student, index) {     $scope.student = student;        $scope.selectedrow = index; }; 

now problem is, list box showing accounts selected students....but selected and, once press on 1 of them, others disappear, while pressed 1 still selected....

on top of that, once go on student, , come back...all disappeared accounts listbox still missing....and old 1 selected...

in end question is:

is possible select student, , accounts shown on listbox without being selected....and not disappearing after press them...?

thx in advance!

just replace varible selected student. :

$scope.setselected = function(student, index) {    $scope.selectedstudent = student;       $scope.selectedrow = index; }; 

html :

 <select ng-model="student.accounts" multiple="multiple"             ng-options="account.name account in selectedstudent.accounts track account.id"      >     </select> 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -