more moving of directives

This commit is contained in:
Colin Frei 2013-02-03 14:08:26 +01:00
parent 43de8a9a10
commit 727215a051
2 changed files with 47 additions and 46 deletions

View file

@ -75,4 +75,45 @@ angular.module('podcast.directives', [])
});
}
}])
.directive('scroll', function() {
return function(scope, element, attrs, feedItems) {
var scroll = new iScroll(element[0]);
};
})
.directive('blob', function() {
return function postLink(scope, element, attrs) {
var updateImage = function () {
var blob = scope.$eval(attrs.blob);
if (blob !== undefined) {
var imgUrl = window.URL.createObjectURL(blob);
element.attr('src', imgUrl);
window.URL.revokeObjectURL(imgUrl);
}
};
scope.$watch(
function() { return scope.$eval(attrs.blob); },
function() { updateImage(); },
true
);
};
})
.directive('setting', function() {
return {
restrict: 'A',
require: '?ngModel',
priority: 1,
link: function(scope, element, attrs, ngModel) {
if (!ngModel) {
return;
}
ngModel.$render = function() {
if (ngModel.$modelValue.value !== '') {
ngModel.$viewValue = ngModel.$modelValue.value;
}
};
}
};
})
;