add watcher to avatar name
This commit is contained in:
@@ -53,7 +53,8 @@ Use this directive to render an avatar.
|
||||
function AvatarDirective() {
|
||||
|
||||
function link(scope, element, attrs, ctrl) {
|
||||
|
||||
|
||||
var eventBindings = [];
|
||||
scope.initials = "";
|
||||
|
||||
function onInit() {
|
||||
@@ -68,6 +69,12 @@ Use this directive to render an avatar.
|
||||
}
|
||||
}
|
||||
|
||||
eventBindings.push(scope.$watch('name', function (newValue, oldValue) {
|
||||
if (newValue === oldValue) { return; }
|
||||
if (oldValue === undefined || newValue === undefined) { return; }
|
||||
scope.initials = getNameInitials(newValue);
|
||||
}));
|
||||
|
||||
onInit();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user