{"id":1791,"date":"2022-08-30T15:19:28","date_gmt":"2022-08-30T15:19:28","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/02\/angular-decorating-directives-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:19:28","modified_gmt":"2022-08-30T15:19:28","slug":"angular-decorating-directives-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/angular-decorating-directives-collection-of-common-programming-errors\/","title":{"rendered":"Angular &#8211; Decorating Directives-Collection of common programming errors"},"content":{"rendered":"<p>This article shows how you can, in fact, use decorator() with directives.<\/p>\n<p>You just have to include &#8220;Directive&#8221; as the suffix for the name. Hence, in my example I should have been doing<\/p>\n<pre><code>return $provide.decorator('myDirectiveDirective', ['$delegate', '$log', function($delegate, $log) {\n    \/\/ TODO - It worked!  Do something to modify the behavior\n    $log.info(\"In decorator\");\n\n    \/\/ Article uses index 0 but I found that index 0 was \"window\" and index 1 was the directive\n    var directive = $delegate[1];\n}\n<\/code><\/pre>\n<p>http:\/\/angular-tips.com\/blog\/2013\/09\/experiment-decorating-directives\/<\/p>\n<p id=\"rop\"><small>Originally posted 2013-12-02 01:31:41. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>This article shows how you can, in fact, use decorator() with directives. You just have to include &#8220;Directive&#8221; as the suffix for the name. Hence, in my example I should have been doing return $provide.decorator(&#8216;myDirectiveDirective&#8217;, [&#8216;$delegate&#8217;, &#8216;$log&#8217;, function($delegate, $log) { \/\/ TODO &#8211; It worked! Do something to modify the behavior $log.info(&#8220;In decorator&#8221;); \/\/ Article [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1791","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1791","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1791"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1791\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1791"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}