upload/src/upload.service.ts
Upload service provides access to files selected in Upload component and allows to remove files or change their upload state.
Example :@Component({
template: `<talenra-upload />`,
imports: [UploadComponent],
providers: [{ provide: UploadService, useClass: UploadService }]
...
})
export class ConfigurableUploadComponent {
private uploadService: UploadService = inject(UploadService);
...
}import { UploadService } from '@talenra/components/upload';See UploadComponent See IUploadItem See UploadState
Properties |
|
Methods |
|
| Public removeItem | ||||||
removeItem(identifier: string)
|
||||||
|
Remove file with given identifier. Example :
Parameters :
Returns :
void
|
| Public setUploadState | |||||||||
setUploadState(identifier: string, state: TUploadState)
|
|||||||||
|
Set upload state of file with given identifier Example :See UploadState
Parameters :
Returns :
void
|
| Public Readonly items |
Type : unknown
|
Default value : this._items.asReadonly()
|
|
Array of currently selected items in Upload component. Example :See IUploadItem |
| Public Readonly validItems |
Type : unknown
|
Default value : computed<IUploadItem[]>(() =>
this._items().filter((item) => item.validationState === UploadValidationState.Valid)
)
|
|
Array of currently selected valid items in Upload component. Example :See IUploadItem |