An annotation to specify that a constant attribute value should be injected.
The directive can inject constant string literals of host element attributes.
Example
Suppose we have an <input>
element and want to know its type
.
<input type="text">
A decorator can inject string literal text
like so:
@Directive(selector: 'input')
class InputAttrDirective {
InputAttrDirective(@Attribute('type') String type) {
// type would be 'text' in this example
}
}
- Inheritance
- Object
- DependencyMetadata
- Attribute
Constructors
- Attribute(String attributeName)
-
const
Properties
- attributeName → String
-
read-only
- hashCode → int
-
Get a hash code for this object.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited - token → dynamic
-
read-only
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
toString(
) → String -
Returns a string representation of this object.