Skip to content

Instantly share code, notes, and snippets.

@djvs
Created May 13, 2014 16:54
Show Gist options
  • Save djvs/c407d422c1fb63498601 to your computer and use it in GitHub Desktop.
Save djvs/c407d422c1fb63498601 to your computer and use it in GitHub Desktop.
app.directive('filestyle', function() {
return {
restrict: 'A',
scope: {
"filestyle": "="
},
transclude : true,
link : function($scope,$element,$attrs){
$attrs.$observe('filestyle',function(value){
if(typeof $scope.filestyle == "string"){
$element.fileinput("<button type='button' class='btn btn-default'>" + $scope.filestyle + "</button>");
} else {
$element.fileinput("<button type='button' class='btn btn-default'>Choose file...</button>");
}
});
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment