Skip to main content

Function: MnComponent

MnComponent<T>(config): (target: T) => void

Decorator that marks a class as a component and provides metadata that indicates where the component must be enabled at runtime.

Typeparam

T Component type

Example

Component that runs on all forms of the contact table.

@MnComponent({
scope: {
pageType: "record",
table: "contact"
}
})
export class ContactRecordComponent { }

Example

Component that runs on a specific form of the account table .

@MnComponent({
scope: {
pageType: "record",
table: "account",
form: {
id: "00000000-0000-0000-0000-000000000000"
}
}
})
export class AccountFormComponent { }

Example

Component that uses a service as dependency.

@Injectable()
export class AccountService { }

@MnComponent({
scope: {
pageType: "record",
table: "account"
},
providers: [{ provide: "accountService", useClass: AccountService }]
})
export class AccountComponent { }

For more information, see dependency injection

Type parameters

NameType
Textends Constructor

Parameters

NameTypeDescription
configComponentConfigComponent configuration

Returns

fn

▸ (target): void

Parameters
NameType
targetT
Returns

void

Defined in

packages/core/src/core/metadata/component.ts:71