Primitives
The file upload primitive allows you to trigger a file upload from any element, giving you the more control over the appearance and behavior compared to the native file input.
Import the FileUpload primitives from ng-primitives/file-upload
.
import { NgpFileUpload } from 'ng-primitives/file-upload';
Assemble the file-upload directives in your template.
<button ngpFileUpload (ngpFileUploadSelected)="onFilesSelected($event)"></button>
Generate a file-upload component with the NgpFileUpload
primitive preconfigured.
ng g ng-primitives:file-upload
The following directives are available to import from the ng-primitives/file-upload
package:
A directive that allows you to turn any element into a file upload trigger.
[ngpFileUpload]
ngpFileUpload
Attribute | Description |
---|---|
data-hover |
Applied when the element is hovered. |
data-focus-visible |
Applied when the element is focus visible. |
data-press |
Applied when the element is pressed. |
data-dragover |
Applied when a file is dragged over the element. |
data-disabled |
Applied when the element is disabled. |
Copyright © 2024 Angular Primitives