百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

ng2-flatpickr

> 前端框架
开源

用于 flatpickr 的 Angular 2+ 封装 (https://GitHub.com/chmln/flatpickr)

100 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

用于 flatpickr 的 Angular 2+ 封装 (https://GitHub.com/chmln/flatpickr)

ng2-flatpickr

ng2-flatpickr is a lightweight Angular wrapper for flatpickr, which is usable in reactive forms inside Angular.

Examples are here: https://mezoistvan.github.io/ng2-flatpickr-examples/.

javascript
npm install --save flatpickr ng2-flatpickr
yarn add flatpickr ng2-flatpickr

How to use:

Import the Ng2FlatpickrModule to your NgModule:

javascript
import { Ng2FlatpickrModule } from 'ng2-flatpickr';

@NgModule({
  imports: [
    Ng2FlatpickrModule
    ...

Example usage in a form component html template:

javascript

Overwrite the default flatpickr properties by inputting any of the flatpickr options: https://chmln.github.io/flatpickr/options/

javascript
import { FlatpickrOptions } from 'ng2-flatpickr';

let exampleOptions: FlatpickrOptions = {
  defaultDate: '2017-03-15'
};

Add locale to the options

javascript
import { FlatpickrOptions } from 'ng2-flatpickr';
import Russian from 'flatpickr/dist/l10n/ru.js';

let exampleOptions: FlatpickrOptions = {
  locale: Russian.ru,
  ...
};

Set a placeholder for the input:

javascript

Set a date using a string or a date object:

javascript
let randomDateString = '1988-09-19';
let randomDateObject = new Date( 1234567891011 );

Flatpickr css needs to be loaded separately. when using @angular/cli, load it in angular.json.

javascript
"styles": [
  "node_modules/flatpickr/dist/flatpickr.min.css"
]

Issues· 50 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptangularangular2angular4angular5

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架