diff --git a/src/uploadx/lib/uploadx.provider.ts b/src/uploadx/lib/uploadx.provider.ts new file mode 100644 index 0000000..2fe7a11 --- /dev/null +++ b/src/uploadx/lib/uploadx.provider.ts @@ -0,0 +1,28 @@ +import { Provider } from '@angular/core'; +import { UPLOADX_OPTIONS, UploadxOptions } from './options'; + +/** + * Provides configuration options for standalone app. + * + * @example + * ```ts + * bootstrapApplication(AppComponent, { + * providers: [ + * provideUploadx({ + * endpoint: uploadUrl, + * allowedTypes: 'video/*,audio/*', + * maxChunkSize: 96 * 1024 * 1024 + * }) + * ] + * }); + * ``` + */ +export function provideUploadx(options: UploadxOptions = {}) { + const providers: Provider[] = [ + { + provide: UPLOADX_OPTIONS, + useValue: options + } + ]; + return providers; +} diff --git a/src/uploadx/public-api.ts b/src/uploadx/public-api.ts index 5f529c8..2d72731 100644 --- a/src/uploadx/public-api.ts +++ b/src/uploadx/public-api.ts @@ -12,5 +12,6 @@ export * from './lib/uploaderx'; export * from './lib/uploadx-drop.directive'; export * from './lib/uploadx.directive'; export * from './lib/uploadx.module'; +export * from './lib/uploadx.provider'; export * from './lib/uploadx.service'; export * from './lib/utils';