Last active
September 9, 2015 14:49
-
-
Save treaz/ab4e840847384705e2d2 to your computer and use it in GitHub Desktop.
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
(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