diff options
| author | Brian Ford | 2013-08-01 14:23:10 -0700 |
|---|---|---|
| committer | Igor Minar | 2013-08-08 10:11:56 -0700 |
| commit | 5d3744ad9b9d3c452e9aeaf9a5ef94dff0aadb67 (patch) | |
| tree | e08df7876aca5ea17181e9ecf758f947eeeecf85 /docs/content/error | |
| parent | e4b6a1eaa4a432b0082c7abbff8f4bb169cf846e (diff) | |
| download | angular.js-5d3744ad9b9d3c452e9aeaf9a5ef94dff0aadb67.tar.bz2 | |
docs(minErr): add minErr description for $compile:ctreq
Closes #3423
Diffstat (limited to 'docs/content/error')
| -rw-r--r-- | docs/content/error/compile/ctreq.ngdoc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/docs/content/error/compile/ctreq.ngdoc b/docs/content/error/compile/ctreq.ngdoc index 065533b7..b8d5590d 100644 --- a/docs/content/error/compile/ctreq.ngdoc +++ b/docs/content/error/compile/ctreq.ngdoc @@ -2,3 +2,48 @@ @name $compile:ctreq @fullName Missing Required Controller @description + +This error occurs when {@link api/ng.$compile template compiler} tries process the directive that specifies the `require` option in a {@link guide/directive#directivedefinitionobject directive definition}, +but the required directive controller is not present on the current DOM element (or its ancestor element, if `^` was specified). + +To resolve this error ensure that there is no typo in the required controller name and that the required directive controller is present on the current element. + +If the required controller is expected to be on a ancestor element, make ensure that you prefix the controller name in the `require` definition with `^`. + +If the required controller is optionally requested, use `?` or `^?` to specify that. + + +Example of a directive that requires {@link api/ng.directive:ngModel ngModel} controller: +``` +myApp.directive('myDirective', function() { + return { + require: 'ngModel', + ... + } +} +``` + +This directive can then be used as: +``` +<input ng-model="some.path" my-directive> +``` + + +Example of a directive that optionally requires a {@link api/ng.directive:form form} controller from an ancestor: +``` +myApp.directive('myDirective', function() { + return { + require: '^?form', + ... + } +} +``` + +This directive can then be used as: +``` +<form name="myForm"> + <div> + <span my-directive></span> + </div> +</form> +``` |
