rodolfocop / ng2-datepicker-bootstrap

Datepicker component to Angular2 - Using css to Bootstrap
3 stars 5 forks source link

ng2-datepicker-bootstrap

Datepicker component to angular2

Hi everyone!

A very simple datepicker for Angular. You should use the version 2.x.x for Angular 2.x.x applications and the version 4.x.x for Angular 4.x.x applications.

Note: This component is ready to AoC (Ahead-of-Time) compilation. Below the operating instructions.

Installation

To install this library, run:

$ npm install ng2-datepicker-bootstrap --save

Use Example:

import {DatePickerModule} from 'ng2-datepicker-bootstrap';
import { FormsModule } from '@angular/forms';

@NgModule({
    declarations: [...],
    imports: [
        //... you others modules
        DatePickerModule,
        FormsModule
    ],
    providers: [...]
})
export class AppModule {}

Import to .angular-cli.json

  "styles": [
        "../node_modules/bootstrap/dist/css/bootstrap.min.css",
        "../node_modules/font-awesome/css/font-awesome.min.css"
      ],
  "scripts": [
    "../node_modules/jquery/dist/jquery.min.js",
    "../node_modules/bootstrap/dist/js/bootstrap.min.js",
    "../node_modules/moment/min/moment.min.js"
  ]

Using

  <app-datepicker [(ngModel)]="model.firstDate" [viewFormat]="'DD/MM/YYYY'" [modelFormat]="'YYYY-MM-DD'"  [id]="'firstDate'" [label]="'To'"></app-datepicker>

Available options: