Page Contents

Home > @loopback/repository > RepositoryMixinDoc > component

RepositoryMixinDoc.component() method

Add a component to this application. Also mounts all the components repositories.

Signature:

component(component: Class<{}>): Binding;

Parameters

Parameter Type Description
component Class<{}> The component to add.

Returns:

Binding

Example


export class ProductComponent {
  controllers = [ProductController];
  repositories = [ProductRepo, UserRepo];
  providers = {
    [AUTHENTICATION_STRATEGY]: AuthStrategy,
    [AUTHORIZATION_ROLE]: Role,
  };
};

app.component(ProductComponent);