| 110 | * @publicApi |
| 111 | */ |
| 112 | export interface Directive { |
| 113 | /** |
| 114 | * The CSS selector that identifies this directive in a template |
| 115 | * and triggers instantiation of the directive. |
| 116 | * |
| 117 | * Declare as one of the following: |
| 118 | * |
| 119 | * - `element-name`: Select by element name. |
| 120 | * - `.class`: Select by class name. |
| 121 | * - `[attribute]`: Select by attribute name. |
| 122 | * - `[attribute=value]`: Select by attribute name and value. |
| 123 | * - `:not(sub_selector)`: Select only if the element does not match the `sub_selector`. |
| 124 | * - `selector1, selector2`: Select if either `selector1` or `selector2` matches. |
| 125 | * |
| 126 | * Angular only allows directives to apply on CSS selectors that do not cross |
| 127 | * element boundaries. |
| 128 | * |
| 129 | * For the following template HTML, a directive with an `input[type=text]` selector, |
| 130 | * would be instantiated only on the `<input type="text">` element. |
| 131 | * |
| 132 | * ```html |
| 133 | * <form> |
| 134 | * <input type="text"> |
| 135 | * <input type="radio"> |
| 136 | * <form> |
| 137 | * ``` |
| 138 | * |
| 139 | */ |
| 140 | selector?: string; |
| 141 | |
| 142 | /** |
| 143 | * Enumerates the set of data-bound input properties for a directive |
| 144 | * |
| 145 | * Angular automatically updates input properties during change detection. |
| 146 | * The `inputs` property accepts either strings or object literals that configure the directive |
| 147 | * properties that should be exposed as inputs. |
| 148 | * |
| 149 | * When an object literal is passed in, the `name` property indicates which property on the |
| 150 | * class the input should write to, while the `alias` determines the name under |
| 151 | * which the input will be available in template bindings. The `required` property indicates that |
| 152 | * the input is required which will trigger a compile-time error if it isn't passed in when the |
| 153 | * directive is used. |
| 154 | * |
| 155 | * When a string is passed into the `inputs` array, it can have a format of `'name'` or |
| 156 | * `'name: alias'` where `name` is the property on the class that the directive should write |
| 157 | * to, while the `alias` determines the name under which the input will be available in |
| 158 | * template bindings. String-based input definitions are assumed to be optional. |
| 159 | * |
| 160 | * @usageNotes |
| 161 | * |
| 162 | * The following example creates a component with two data-bound properties. |
| 163 | * |
| 164 | * ```ts |
| 165 | * @Component({ |
| 166 | * selector: 'bank-account', |
| 167 | * inputs: ['bankName', {name: 'id', alias: 'account-id'}], |
| 168 | * template: ` |
| 169 | * Bank Name: {{bankName}} |
no outgoing calls
no test coverage detected
searching dependent graphs…