@@ -566,7 +568,9 @@
{{vin.value| number}} {{$root.unitName}}
-
{{vin.addr}}
+
+
+
@@ -575,7 +579,9 @@
{{vout.value| number}} {{$root.unitName}}
-
{{vout.addr}}
+
+
+
diff --git a/js/directives.js b/js/directives.js
index c8ef3c573..c72ffc970 100644
--- a/js/directives.js
+++ b/js/directives.js
@@ -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',
diff --git a/test/unit/directives/directivesSpec.js b/test/unit/directives/directivesSpec.js
index d7186c41f..755281893 100644
--- a/test/unit/directives/directivesSpec.js
+++ b/test/unit/directives/directivesSpec.js
@@ -80,6 +80,31 @@ describe("Unit: Testing Directives", function() {
});
});
+ describe('Contact directive', function() {
+ var element1, element2;
+
+ beforeEach(inject(function($compile, $rootScope) {
+ $rootScope.wallet = {
+ addressBook: {'2MtBXKLtZuXGDshUcyH6yq7aZ33Snbb49pT': {label: ':)'}}
+ }
+ element1 = angular.element(
+ '
'
+ );
+ element2 = angular.element(
+ '
'
+ );
+ $compile(element1)($rootScope);
+ $compile(element2)($rootScope);
+ $rootScope.$digest();
+ }));
+
+ it('should replace the content', function() {
+ expect(element1.html()).to.equal(':)');
+ expect(element2.html()).to.equal('2MvCKdnwEMiaexi247gi738U6pwUFZxbhXn');
+ });
+
+ });
+
describe('Password strength', function() {
beforeEach(inject(function($compile, $rootScope) {
$scope = $rootScope;