
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2019 09:27 PM
Hi All,
Need help in using the <sn-avatar>. See the attached image. No matter which user I add, it is always displaying the current user image. Not sure where I am going wrong.
I have used the below code:
HTML:
<span class="navbar-avatar">
<sn-avatar class="avatar-small-medium" primary="userID" show-presence="false" />
</span>
client controller:
$scope.userID = $scope.user.sys_id;
Help is appreciated.
Regards,
Dheeraj
Solved! Go to Solution.
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2019 10:59 PM
updated client controller code.
function($scope, spUtil, $sce, $rootScope, $timeout) {
var c = this;
$("#share-link-input")[0].value = window.location;
c.data.userList = [];
c.data.action = "";
$scope.shareuser = {
displayValue: '',
value: '',
name: 'shareuser'
};
$scope.isUserListEmpty = function() {
return c.data.userList.length < 1;
};
c.select = function() {
$("#share-link-input").select();
};
c.copyURL = function() {
c.select();
document.execCommand("copy");
$(".share-custom-message").fadeToggle();
setTimeout(function(){
$(".share-custom-message").fadeToggle();
},500);
};
c.removeUser = function(index) {
c.data.userList.splice(index,1);
};
c.submit = function() {
c.data.action = "submit";
var url = $("#share-link-input")[0].value;
c.data.document_id = url.slice(url.indexOf("sys_id=")+7);
c.data.message = $("#share-note-input")[0].value;
c.data.urlType = $("#url-type")[0].value;
c.server.update().then(function(response) {
spUtil.update($scope);
c.data.action = '';
$("#share-note-input")[0].value = '';
});
};
$scope.$on("field.change", function(evt, parms) {
if(parms.field.name == 'shareuser') {
$scope.userID = parms.newValue;
c.data.userId = parms.newValue;
c.data.action = "addUser";
}
if(c.data.action == '') {
return;
}
c.server.update().then(function(response) {
spUtil.update($scope);
c.data.action = '';
$scope.shareuser = {
displayValue: '',
value: '',
name: 'shareuser'
};
});
});
}
If my answer helped you, mark it as correct and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2019 11:33 PM
Thanks Harsha. I see that when adding more users to the list, the existing avatars are changing as that of last added.
Regards,
Dheeraj