diff options
| author | Peter Bacon Darwin | 2014-02-16 22:02:31 +0000 | 
|---|---|---|
| committer | Peter Bacon Darwin | 2014-02-16 22:02:41 +0000 | 
| commit | 33e1bdc543bcb7875dcc004d487333393670ed2d (patch) | |
| tree | 7ff1f564ab486f049b7e9e5ad946a6a88bb651b6 /docs/content/error/$compile/ctreq.ngdoc | |
| parent | 49f90e559ed412402ad7444bc2db2bc1c182ddf5 (diff) | |
| download | angular.js-33e1bdc543bcb7875dcc004d487333393670ed2d.tar.bz2 | |
chore(errors): rename folders to match namespaces
Diffstat (limited to 'docs/content/error/$compile/ctreq.ngdoc')
| -rw-r--r-- | docs/content/error/$compile/ctreq.ngdoc | 49 | 
1 files changed, 49 insertions, 0 deletions
| diff --git a/docs/content/error/$compile/ctreq.ngdoc b/docs/content/error/$compile/ctreq.ngdoc new file mode 100644 index 00000000..47c876a3 --- /dev/null +++ b/docs/content/error/$compile/ctreq.ngdoc @@ -0,0 +1,49 @@ +@ngdoc error +@name $compile:ctreq +@fullName Missing Required Controller +@description + +This error occurs when {@link ng.$compile HTML compiler} tries to process a directive that specifies the {@link ng.$compile#description_comprehensive-directive-api_directive-definition-object `require` option} in a {@link ng.$compile#description_comprehensive-directive-api 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 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 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> +``` | 
