Created
June 18, 2016 23:33
-
-
Save lrkwz/96b0ffadb2b5365436f3f5d1afb6ce19 to your computer and use it in GitHub Desktop.
Fontawesome iconify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular | |
.module('myapp', [...]) | |
.filter('iconify', ['$sce', function($sce){ | |
return function(input, type){ | |
var iconType = 'fa-file-o'; | |
if( input ){ | |
if( input.startsWith('image/')){ | |
iconType = 'fa-file-pdf-o'; | |
} else if (input == 'application/pdf') { | |
iconType = 'fa-file-image-o'; | |
} | |
} else { | |
input = ''; | |
} | |
var out = '<i class="' + input +' fa fa-2x '+iconType+'" aria-hidden="true"></i>'; | |
return $sce.trustAs( type || 'html', out); | |
} | |
}]) | |
.run(run); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Include fontawsome using
then drop somewhere in your template