diff options
| author | Chris Nicola | 2013-04-29 16:01:58 -0700 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-04-30 10:53:17 +0100 |
| commit | 4dba7b0203c018c6e258c04f70e216149a991f06 (patch) | |
| tree | 4444d63d3f2ce2bacc96db30a8346a2bebafe850 /docs/content/guide/directive.ngdoc | |
| parent | d3cd3c0a9baa27a552cabe1938931743c13d307e (diff) | |
| download | angular.js-4dba7b0203c018c6e258c04f70e216149a991f06.tar.bz2 | |
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.
Diffstat (limited to 'docs/content/guide/directive.ngdoc')
| -rw-r--r-- | docs/content/guide/directive.ngdoc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/content/guide/directive.ngdoc b/docs/content/guide/directive.ngdoc index 3fd27a3c..176d6c62 100644 --- a/docs/content/guide/directive.ngdoc +++ b/docs/content/guide/directive.ngdoc @@ -244,6 +244,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) { ... }, @@ -365,6 +366,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: + + <pre> + controller: ['$scope', '$element', '$attrs', '$transclude', function($scope, $element, $attrs, $transclude) { ... }] + </pre> + * `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: |
