Function: MnInput
▸ MnInput(): (target
: DecoratorTarget
<unknown
>, targetKey?
: string
| symbol
, indexOrPropertyDescriptor?
: number
| TypedPropertyDescriptor
<any
>) => void
Decorator that mark a property of a component as input.
The input property name must be input
. An other property name is not supported.
The Input
interface contains this constraint.
It is recommended to inherit from it when you need to define an input in your component.
The input property will be set by the value given by the parent component. See MnSubComponent for more information about transmission of the input from a parent component to its sub component.
Example
A parent component send an input (10, "hello") to its sub component.
@MnComponent({
scope: {
pageType: "record"
}
})
class ParentComponent {
@MnSubComponent({
component: ChildComponent,
input: {
value1: 10,
value2: "hello"
}
})
child: SubComponent<ChildComponent>;
}
@MnComponent({
scope: {
pageType: "record"
}
})
class ChildComponent implements Input {
@MnInput()
input: {
value1: number;
value2: string;
};
}
Returns
fn
▸ (target
, targetKey?
, indexOrPropertyDescriptor?
): void
Parameters
Name | Type |
---|---|
target | DecoratorTarget <unknown > |
targetKey? | string | symbol |
indexOrPropertyDescriptor? | number | TypedPropertyDescriptor <any > |
Returns
void