The require
parameter, including its prefixes, is documented on the $compile
API reference page.
Require another directive and inject its controller as the fourth argument to the linking function. The require takes a string name (or array of strings) of the directive(s) to pass in. If an array is used, the injected argument will be an array in corresponding order. If no such directive can be found, or if the directive does not have a controller, then an error is raised. The name can be prefixed with:
- (no prefix) – Locate the required controller on the current element. Throw an error if not found.
?
– Attempt to locate the required controller or passnull
to thelink
fn if not found.^
– Locate the required controller by searching the element and its parents. Throw an error if not found.^^
– Locate the required controller by searching the element’s parents. Throw an error if not found.?^
– Attempt to locate the required controller by searching the element and its parents or pass
null
to thelink
fn if not found.?^^
– Attempt to locate the required controller by searching the element’s parents, or pass
null
to thelink
fn if not found.