Skip to content

Instantly share code, notes, and snippets.

@unkleara
Created November 27, 2013 02:24
Show Gist options
  • Save unkleara/7669751 to your computer and use it in GitHub Desktop.
Save unkleara/7669751 to your computer and use it in GitHub Desktop.
dl common buttons
app.directive('editButton', [ function(){
return {
restrict: 'EA',
replace : true,
scope : {
text : '@',
action : '&'
},
template: '<button class="btn btn-xs btn-info" ng-click="action()"><i class="fa fa-edit"></i> {{text}}</button>'
};
}]);
app.directive('deleteButton', [ function(){
return {
restrict: 'EA',
replace : true,
scope : {
text : '@',
action : '&'
},
template: '<button class="btn btn-xs btn-danger" ng-click="action()"><i class="fa fa-trash-o"></i> {{text}}</button>'
};
}]);
app.directive('showError', [ function(){
return {
restrict: 'EA',
replace : true,
scope : {
text : '@',
action : '&'
},
template: '<small class="error" ng-show="action()">*{{text}}.</small>'
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment