This repository was archived by the owner on Aug 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
This repository was archived by the owner on Aug 19, 2025. It is now read-only.
Gravatar default watch for changes #20
Copy link
Copy link
Open
Description
Hi,
I am trying to add the gravatar-src with gravatar-default in a ui-select dropdown, the problem is that the gravatar directive renders before the $select.selected object is set, so it ends up not rendering the fallback avatar correctly.
Note: the values are displayed correctly in the dropdown itself but not on the selected object that is retrieved using the $select.selected variable, and I've double checked that the data goes to the function correctly, I just believe it goes late after rendering.
This is the fallback function
$rootScope.getFallbackGravatar = function(name, email) {
if (name != 'undefined' && name != undefined && name.length > 0) {
return "http://placehold.it/70/f1f1f1/2c3e50&text=" + name.substring(0,2).toUpperCase();
}else if (email != 'undefined' && email != undefined && email.length > 0){
return "http://placehold.it/70/f1f1f1/2c3e50&text=" + email.substring(0,2).toUpperCase();
}else{
return "http://placehold.it/70/f1f1f1/2c3e50&text=NA";
}
};
And this is the ui-select code
<ui-select ng-model="defaultAssignee.selected" theme="select2" search-enabled="false" ng-change="assigneeChange()">
<ui-select-match placeholder="Select Assignee">
<img gravatar-default="{{getFallbackGravatar($select.selected.name.name, $select.selected.name.email)}}" gravatar-src="$select.selected.name.email" alt="" class="user-thumb">
<span>{{$select.selected.name.name}}</span>
</ui-select-match>
<ui-select-choices repeat="assignee in issue.assignee ">
<img gravatar-default="{{getFallbackGravatar(assignee.name.name, assignee.name.email)}}" gravatar-src="assignee.name.email" alt="" class="user-thumb">
<span>{{assignee.name.name}}</span>
</ui-select-choices>
</ui-select> Metadata
Metadata
Assignees
Labels
No labels