Skip to content

Instantly share code, notes, and snippets.

@Igosuki
Last active August 29, 2015 14:00
Show Gist options
  • Save Igosuki/5baa748f2e0040c547fe to your computer and use it in GitHub Desktop.
Save Igosuki/5baa748f2e0040c547fe to your computer and use it in GitHub Desktop.
var kittens = angular.module("ngKitten", []);
kittens.directive('kittens', function factory() {
var kittensDirective = {
restrict: 'AC',
scope: false,
compile: function compile(tElement, tAttrs, transclude) {
return {
pre: function preLink(scope, element, attrs) {
element.attr('ng-src', 'http://placekitten.com/'+element.attr('width')+'/'+element.attr('height');
}
}
},
};
return kittensDirective;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment