@filestack/angular

中文文档
4.0.0发布于 2026/07/29TypeScriptES Module近 30 天下载 1.1万

filestack-angular

Angular component library which allow you to easily integrate powerful filestack-api into your app.

原始使用文档
文档目录11 节
  1. Overview
  2. Usage
  3. Installation
  4. CDN
  5. Available inputs
  6. Available outputs
  7. FilestackService
  8. Examples
  9. Documentation
  10. Development
  11. Contributing

filestack-angular

Angular component library which allow you to easily integrate powerful filestack-api into your app.

Table of Contents

Overview

filestack-angular is a kind of wrapper on filestack-js sdk which allow you to integrate with filestack service in just a few lines of code. Almost all you are able to do with filestack-js you can also do using this component.

This repository a contains angular workspace with two projects:

  • filestack-angular library which contains FilestackAngularModule published via npm
  • example angular app to show examples of using FilestackModule features

FilestackAngularModule consists of

  • FilestackService - wrapper for a filestack-js client class with added support for an observables
  • FilestackTransformPipe - Pipe for easily creating url with transformations in your template
  • PickerOverlayComponent - Filestack picker component that will open in overlay mode
  • PickerInlineComponent - Filestack picker component that will open in a provided html container
  • PickerDropPaneComponent - Filestack drop pane component that will open in a provided html container which can be also used independently if needed

Usage

Installation

Install it through NPM (the filestack-js SDK is installed automatically as a dependency)

npm install filestack-js
npm install @filestack/angular

Include FilestackModule in app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { FilestackModule } from '@filestack/angular';
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FilestackModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

Use in .html file

<ng-picker-overlay
  apikey="YOUR_API_KEY">
</ng-picker-overlay>

CDN

In the case you would like to import filestack-module bundle file directly to your app instead of using npm package you can find it on our cdn:

https://static.filestackapi.com/filestack-angular/{MODULE_VERSION}/filestack-angular.umd.min.js
https://static.filestackapi.com/filestack-angular/{MODULE_VERSION}/filestack-angular.umd.min.js.map

where {MODULE_VERSION} is desired version of this package

Available inputs

NameTypeRequiredDefaultDescription
apikeyStringTrueFilestack api key
optionsObjectCheck pickerOptions
clientOptions.cnameStringCheck cname
clientOptions.securityObject(Security)Check security
clientOptions.sessionCacheBooleanCheck sessionCache
fileInputFile
sourceStringFilestack handle or external url. Use it for 'transform', 'remove', 'metadata' or 'preview' action

Available outputs

NameTypeRequiredDefaultDescription
uploadSuccessSubjectA subject that emits on uploadSuccess event
uploadErrorSubjectA subject that emits on uploadError event

FilestackService

The FilestackService is an adapter on filestack-js client class and allows you to work with Observables instead of promises. Methods get the same input params as client class method.

methodreturndescription
initvoidInit filestack client with your apikey
pickerPickerInstanceOpen or close picker instance
transformstringCreate a transformation url
retrieveObservableRetrieve an info about a filestack handle
metadataObservableAccess files via their Filestack handles
storeURLObservableGet info about a filestack handle metadata
uploadObservableUpload a file to the Filestack
removeObservableRemove a file from the Filestack
removeMetadataObservableRemove a file only from the Filestack system. The file remains in storage.
previewHTMLIFrameElementWindow
logoutObservableClear cloud session from picker procviders
setClientInstanceClientInstancePut an existing client instance into filestack service

Examples

Below you can find some basic examples.

You can also find and try these examples in angular-filestack-example app

To run it locally type

ng serve filestack-angular-example

then visit

http://localhost:4200/

Open picker directly after component initialization

component.ts

export class AppComponent implements OnInit {
  apikey: string;

  ngOnInit() {
    this.apikey = 'YOUR_API_KEY';
  }
}

component.html

<ng-picker-overlay
  [apikey]="apikey">
</ng-picker-overlay>

Open picker by clicking the custom button

component.ts

export class AppComponent implements OnInit {
  apikey: string;

  ngOnInit() {
    this.apikey = 'YOUR_API_KEY';
    this.onSuccess = (res) => console.log('###onSuccess', res);
    this.onError = (err) => console.log('###onErr', err);
  }

  onUploadSuccess(res: object) {
    console.log('###uploadSuccess', res);
  }

  onUploadError(err: any) {
    console.log('###uploadError', err);
  }
}

component.html

<ng-picker-overlay
  [apikey]="apikey"
  (uploadSuccess)="onUploadSuccess($event)"
  (uploadError)="onUploadError($event)">
  <button>Open picker</button>
</ng-picker-overlay>

Open picker in inline mode

component.ts

export class AppComponent implements OnInit {
  apikey: string;

  ngOnInit() {
    this.apikey = 'YOUR_API_KEY';
  }

  onUploadSuccess(res: object) {
    console.log('###uploadSuccess', res);
  }

  onUploadError(err: any) {
    console.log('###uploadError', err);
  }
}

component.html

<ng-picker-inline
  [apikey]="apikey"
  (uploadSuccess)="onUploadSuccess($event)"
  (uploadError)="onUploadError($event)">
  <button>Open picker</button>
</ng-picker-inline>

Open picker in drop pane mode

component.ts

export class AppComponent implements OnInit {
  apikey: string;

  ngOnInit() {
    this.apikey = 'YOUR_API_KEY';
  }

  onUploadSuccess(res: object) {
    console.log('###uploadSuccess', res);
  }

  onUploadError(err: any) {
    console.log('###uploadError', err);
  }
}

component.html

<ng-picker-drop-pane
  [apikey]="apikey"
  (uploadSuccess)="onUploadSuccess($event)"
  (uploadError)="onUploadError($event)">
</ng-picker-drop-pane>

Get transformed url using filestackTransform pipe

component.ts

...
import { TransformOptions } from 'filestack-js';

export class AppComponent implements OnInit {
  transformOptions: TransformOptions;

  constructor(private filestackService: FilestackService) {}

  ngOnInit() {
    this.transformOptions = {
      resize: {
        width: 400
      },
      sepia: {
        tone: 80
      }
    }
  }
}

component.html

  <img src="{{'5aYkEQJSQCmYShsoCnZN' | filestackTransform: transformOptions}}">

Select file and upload using sdk client.upload()

component.ts

export class AppComponent implements OnInit {
  file: any;

  constructor(private filestackService: FilestackService) {}

  ngOnInit() {
    this.filestackService.init('YOUR_API_KEY'); 
  }
  fileChanged(e) {
    this.file = e.target.files[0];
  }
  uploadFile() {
    this.filestackService.upload(this.file)
      .subscribe(res => console.log(res));
  }
}

component.html

  <input type='file' (change)="fileChanged($event)">
  <button (click)="uploadFile()">Upload file</button>

Documentation

You can find necessary info about avalaible options for actions (Client class methods) at https://filestack.github.io/filestack-js/

Development

After adding changes to FilestackAngularModule in /projects/filestack-angular/src

you need to build this module

ng build filestack-angular

this command will produce /dist which conatins ready to use filestack module

you can check correctness of it by checking examples from example app:

  1. Update api key in /projects/example/src/app/app.component.ts

  2. start app locally

ng serve example
  1. visit http://localhost:4200/

Contributing

Any of your contributions or ideas are more than welcome. Please consider that we follow the conventional commits specification to ensure consistent commit messages and changelog formatting.

版本与发布记录

@filestack/angular 共发布 26 个版本,首次发布于 2019/07/25;过去 12 个月发布了 6 个版本。

版本发布日期距今
4.0.0latest2026/07/293 个月前
4.0.0-beta.3beta2026/07/233 个月前
4.0.0-beta.22026/07/154 个月前
4.0.0-beta.12026/07/074 个月前
5.0.02026/07/074 个月前
4.0.0-beta.02026/07/074 个月前

关于 @filestack/angular 的常见问题

@filestack/angular 是什么?

filestack-angular Angular component library which allow you to easily integrate powerful filestack-api into your app.

如何安装 @filestack/angular?

在项目目录运行 npm install @filestack/angular,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/common(>=19.0.0)、@angular/core(>=19.0.0)、filestack-js(>3.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@filestack/angular 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@filestack/angular 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@filestack/angular 可以商用吗?

@filestack/angular 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@filestack/angular 的下载量有多少?

根据 npm 官方下载统计,@filestack/angular 在 2026/10/15 – 2026/11/13 这 30 天内被下载 11,155 次,日均约 372 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@filestack/angular 还在维护吗?

最新版本 4.0.0 发布于 2026/07/29(3 个月前);至今共发布 26 个版本,其中过去 12 个月发布了 6 个;首次发布于 2019/07/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。