From fc25a443f8595ec8761675595af58ec873452896 Mon Sep 17 00:00:00 2001 From: Chris Nicola Date: Mon, 29 Apr 2013 16:01:58 -0700 Subject: docs(guide:directive): add directive controller usage Specifically adding a directive controller to the example definition and how to use declare injectables to avoid minification errors. --- docs/content/guide/directive.ngdoc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'docs') diff --git a/docs/content/guide/directive.ngdoc b/docs/content/guide/directive.ngdoc index 7cf6cf08..22dd639e 100644 --- a/docs/content/guide/directive.ngdoc +++ b/docs/content/guide/directive.ngdoc @@ -269,6 +269,7 @@ Here's an example directive declared with a Directive Definition Object: transclude: false, restrict: 'A', scope: false, + controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... }, compile: function compile(tElement, tAttrs, transclude) { return { pre: function preLink(scope, iElement, iAttrs, controller) { ... }, @@ -392,6 +393,12 @@ compiler}. The attributes are: * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope: `function(cloneLinkingFn)`. + To avoid errors after minification the bracket notation should be used: + +
+ controller: ['$scope', '$element', '$attrs', '$transclude', function($scope, $element, $attrs, $transclude) { ... }]
+
+
* `require` - Require another controller be passed into current directive linking function. The
`require` takes a name of the directive controller to pass in. If no such controller can be
found an error is raised. The name can be prefixed with:
--
cgit v1.2.3