本文说明了实际上如何将带指令的decorator()使用。
您只需将“指令”作为名称的后缀即可。因此,在我的示例中,我应该一直在做
return $provide.decorator('myDirectiveDirective', ['$delegate', '$log', function($delegate, $log) { // TODO - It worked! Do something to modify the behavior $log.info("In decorator"); // Article uses index 0 but I found that index 0 was "window" and index 1 was the directive var directive = $delegate[1];}http://angular-tips.com/blog/2013/09/experiment-decorating-
directives/



