Skip to content

Instantly share code, notes, and snippets.

@treaz
Last active September 9, 2015 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save treaz/ab4e840847384705e2d2 to your computer and use it in GitHub Desktop.
Save treaz/ab4e840847384705e2d2 to your computer and use it in GitHub Desktop.
(function () {
'use strict';
angular.module('directives', [])
.directive("lumHelpButton", directiveFunction);
function directiveFunction() {
var directive= {
restrict: "E",
scope: {
text: "@text",
},
template:
'<md-button ng-class="vm.buttonPressed ? \'md-accent\' : \'md-primary\'" ng-click="vm.helpClicked()">' +
'<md-tooltip md-visible="vm.buttonPressed">{{text}}</md-tooltip>' +
'<md-icon class="material-icons md-light md-48" aria-hidden="true"> help</md-icon>' +
'</md-button>',
controller: TooltipController,
controllerAs: 'vm',
};
return directive;
};
function TooltipController() {
var vm = this;
vm.helpClicked = helpClicked;
vm.buttonPressed = false;
function helpClicked(){
vm.buttonPressed = vm.buttonPressed === false ? true: false;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment