Add directive to render address from the book with a tooltip

This commit is contained in:
Yemel Jardi 2014-06-23 17:34:54 -03:00
commit 099a282fb9
3 changed files with 52 additions and 4 deletions

View file

@ -122,6 +122,23 @@ angular.module('copayApp.directives')
}
}
})
.directive('contact', function() {
return {
restrict: 'E',
link:function(scope, element, attrs) {
if (!scope.wallet) return;
var address = attrs.address;
var contact = scope.wallet.addressBook[address];
if (contact) {
element.append(contact.label);
attrs['tooltip'] = attrs.address;
} else {
element.append(address);
}
}
};
})
.directive('highlightOnChange', function() {
return {
restrict: 'A',