I have a list of users generated with ng-repeat and data from db, which works fine. Now when you click on a user, you get a popup box. I would like to display the name of the selected user in this popup box, but I don't know how to access the username because the ng-repeat does not take place in the popup box.
Note that I work with angular material
Part of my html code:
<!-- START SIDEBAR -->
<div id="logo-wrap">
<img id="logo" src="assets/images/logo2.png" alt="Zazzle Logo" >
</div>
<div id="sidebar" class="md-whiteframe-z4" ng-data-color="">
<div style="height: 80px;"></div>
<div class="userList" id="usrL">
<li id="customLI" ng-repeat="user in users" id="userPos" class="active circular md-whiteframe-z2" style="background-color: {{ user.color }} " ng-click="showPopUpDeletionConfirmation($event, user._id); " ng-data-id="{{ user._id }}">
<div ng-if="user._id==activeUser" class="wrapperImageCurrentUser" id="marker_active_user"> </div>
<p class="initials" id="userValue" style="top: {{ user.top }};" >
<custom id="user._id"></custom>
{{user.initials}}
<!-- {{user.email}} -->
</p>
<md-tooltip>{{user.name}}</md-tooltip>
</li>
</div>
</div>
<!-- END SIDEBAR -->
The code for the popup box (html) resides in the file dialog1.tmpl. This file is just the layout of the popup box nothing relevant to share the code in this question
Here is a visual of my user list and popup box -> https://gyazo.com/694f65c5269cbca910ec6989ee5a77c2
Change this:
to this:
and access
user
object in the popupEDIT:
You need also to change the
showPopUpDeletionConfirmation
with this:And then you can access the entire
user
object in the popup template with$scope.selectedUser
or something like{{selectedUser.name}}
You don't access the user in the popup, you pass the user to the popup.
You are already sending the users id, just send the entire user. Use
user.name
anduser._id
after you've send it.