项目作者: NGNOTFND

项目描述 :
Component that uses the native date picker and binds the typed value to Date.
高级语言: TypeScript
项目地址: git://github.com/NGNOTFND/ng-typed-date.git
创建时间: 2021-05-17T19:46:16Z
项目社区:https://github.com/NGNOTFND/ng-typed-date

开源协议:MIT License

下载


CI

NgTypedDate

Directive that uses the native date picker and binds the typed value to Date.

How to install with npm ?

  1. npm i @ng-not-found/ng-typed-date --save

What is this component for?

This te directive has the purpose of facilitating the use of date fields, making the binding in the model in a typed way.

When working with dates in Angular, it binds with a string and that’s usually not what we need. We need it to be a valid Date.

How do I use it?

  1. import { BrowserModule } from '@angular/platform-browser';
  2. import { NgModule } from '@angular/core';
  3. import { AppRoutingModule } from './app-routing.module';
  4. import { AppComponent } from './app.component';
  5. import { FormsModule } from '@angular/forms';
  6. import { NgTypedDateModule } from '@ng-not-found/ng-typed-date';
  7. @NgModule({
  8. declarations: [
  9. AppComponent,
  10. ],
  11. imports: [
  12. FormsModule,
  13. BrowserModule,
  14. AppRoutingModule,
  15. NgTypedDateModule
  16. ],
  17. providers: [],
  18. bootstrap: [AppComponent]
  19. })
  20. export class AppModule { }
  1. <form #form="ngForm">
  2. <input type="date" [(ngModelDate)]="data" name="data" />
  3. <input type="datetime-local" [(ngModelDate)]="data" name="data" />
  4. </form>

Properties

Name Type
min Date / string
max Date / string