Fix avatar in the user view
This commit is contained in:
parent
f67eeee8c8
commit
2d8237bd83
3 changed files with 17 additions and 12 deletions
|
@ -1,17 +1,20 @@
|
|||
/**
|
||||
* Adds a ng-image-watch attribute, which is a callback invoked when the image is loaded or fails.
|
||||
*/
|
||||
angular.module('quay').directive('ngImageWatch', function () {
|
||||
angular.module('quay').directive('ngImageWatch', function ($parse) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function postLink($scope, $element, $attr) {
|
||||
$element.bind('error', function() {
|
||||
$scope.$eval($attr.ngImageWatch)(false);
|
||||
});
|
||||
compile: function($element, attr) {
|
||||
var fn = $parse(attr['ngImageWatch']);
|
||||
return function(scope, element) {
|
||||
element.bind('error', function() {
|
||||
fn(scope, {result: false});
|
||||
});
|
||||
|
||||
$element.bind('load', function() {
|
||||
$scope.$eval($attr.ngImageWatch)(true);
|
||||
});
|
||||
element.bind('load', function() {
|
||||
fn(scope, {result: true});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
Reference in a new issue