@primno/core
Version:
Front-end framework for Model-Driven Apps of Power Apps and Dynamics 365.
34 lines (33 loc) • 1.09 kB
TypeScript
/**
* Decorator on a dependency that specifies the identifier for that dependency.
*
* @example Inject `MyService` into `MyComponent` using the identifier (token) "ServiceIdentifier".
* ```ts
* interface Service {
* doSomething(): void;
* }
*
* @Injectable()
* class MyService implements Service {
* doSomething() {
* console.log("Hello World!");
* }
* }
*
* @MnComponent({
* providers: [
* { provide: "ServiceIdentifier", useClass: MyService }
* ]
* })
* export class MyComponent {
* // Search for a dependency with the identifier "ServiceIdentifier" and inject it into this property.
* @Inject("ServiceIdentifier")
* myService: Service;
* }
* ```
*
* @category Dependency Injection
* @param serviceIdentifier Identifier of the dependency.
* @returns
*/
export declare function Inject(serviceIdentifier: any): (target: import("inversify/lib/annotation/decorator_utils").DecoratorTarget<unknown>, targetKey?: string | symbol | undefined, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<any> | undefined) => void;