diff --git a/dist/angularjs-gravatardirective.js b/dist/angularjs-gravatardirective.js index 7348eb5..fae5bd5 100644 --- a/dist/angularjs-gravatardirective.js +++ b/dist/angularjs-gravatardirective.js @@ -33,8 +33,6 @@ angular.module('angularjs-gravatardirective.directives') return { restrict: "EAC", link: function (scope, elm, attrs) { - // by default the values will come in as undefined so we need to setup a - // watch to notify us when the value changes function ctrl(value, mode) { // check inputs if ((value === null) || (value === undefined) || (value === '')) { @@ -67,9 +65,10 @@ angular.module('angularjs-gravatardirective.directives') elm.find('img').bind('error', function () { elm.find('img').remove(); }); - } + // by default the values will come in as undefined so we need to setup a + // watch to notify us when the value changes scope.$watch(attrs.gravatarEmail, function (value) { ctrl(value, 'email'); }); diff --git a/src/angularjs-gravatardirective/directives/gravatar-directive.js b/src/angularjs-gravatardirective/directives/gravatar-directive.js index 34e9a49..5aa80b2 100644 --- a/src/angularjs-gravatardirective/directives/gravatar-directive.js +++ b/src/angularjs-gravatardirective/directives/gravatar-directive.js @@ -3,8 +3,6 @@ angular.module('angularjs-gravatardirective.directives') return { restrict: "EAC", link: function (scope, elm, attrs) { - // by default the values will come in as undefined so we need to setup a - // watch to notify us when the value changes function ctrl(value, mode) { // check inputs if ((value === null) || (value === undefined) || (value === '')) { @@ -37,9 +35,10 @@ angular.module('angularjs-gravatardirective.directives') elm.find('img').bind('error', function () { elm.find('img').remove(); }); - } + // by default the values will come in as undefined so we need to setup a + // watch to notify us when the value changes scope.$watch(attrs.gravatarEmail, function (value) { ctrl(value, 'email'); });