Created
November 15, 2015 07:35
-
-
Save vvscode/9c2a5b72cb7c7160809f to your computer and use it in GitHub Desktop.
onlyForAdmin directive
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('smartjs').directive('onlyForAdmin', function(ngIfDirective) { | |
ngIfDirective = ngIfDirective[0]; | |
return { | |
transclude: ngIfDirective.transclude, | |
priority: ngIfDirective.priority, | |
terminal: ngIfDirective.terminal, | |
restrict: ngIfDirective.restrict, | |
link: function($scope, $element, $attr) { | |
$attr.ngIf = 'user.isAdmin'; | |
ngIfDirective.link.apply(ngIfDirective, arguments); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment