Marks a class as an Angular directive. You can define your own
directives to attach custom behavior to elements in the DOM.
The options provide configuration metadata that determines
how the directive should be processed, instantiated and used at
runtime.
Enumerates the set of data-bound input properties for a directive
inputs: string[]
inputs: string[]
Angular automatically updates input properties during change detection.
The inputs property defines a set of directiveProperty to bindingProperty
configuration:
directiveProperty specifies the component property where the value is written.
bindingProperty specifies the DOM property where the value is read from.
When bindingProperty is not provided, it is assumed to be equal to directiveProperty.
Angular automatically checks host property bindings during change detection.
If a binding changes, Angular updates the directive's host element.
When the key is a property of the host element, the property value is
the propagated to the specified DOM property.
When the key is a static attribute in the DOM, the attribute value
is propagated to the specified property in the host element.
For event handling:
The key is the DOM event that the directive listens to.
To listen to global events, add the target to the event name.
The target can be window, document or body.
The value is the statement to execute when the event occurs. If the
statement evalueates to false, then preventDefault is applied on the DOM
event. A handler method can refer to the $event local variable.
Directives are declarables.
They must be declared by an NgModule
in order to be usable in an app.
A directive must belong to exactly one NgModule. Do not re-declare
a directive imported from another module.
List the directive class in the declarations field of an NgModule.