Datasource Inline

Edit on GitHub

This document explains the Datasource Inline service in the Components Library.

Overview

Datasource Inline is an Angular Service that allows passing data along with the configuration of the Datasource.

Check out an example usage of the Datasource Inline.

Service configuration:

  • type - a datasource type.
  • data - a datasource data.
<spy-select
    [datasource]="{
        type: 'inline',
        data: ['Inline 1', 'Inline 2'],
    }"
>
</spy-select>

Service registration

Register the service:

@NgModule({
    imports: [
        DatasourceModule.withDatasources({
            inline: DatasourceInlineService,
        }),
    ],
})
export class RootModule {}

Interfaces

Below you can find interfaces for the Datasource Inline:

declare module '@spryker/datasource' {
    interface DatasourceRegistry {
        inline: DatasourceInlineService;
    }
}

export interface DatasourceInlineConfig extends DatasourceConfig {
    data: unknown;
}