Skip to main content

Posts

Showing posts with the label Angular 5 Datepicker

Angular 5 Datepicker with Min and Max Date Validation

What Is Datepicker? Datepicker allows us to enter a date as input text or pick a date from calendar . The min and max are the date properties which used to validate the input range and these properties will disable before and after dates on the calendar popup. In the below example - min date is - 2017 and max date is 2019 , so all the before 2017and after 2019 dates will be disable on the calendar popup i.e. The example for Datepicker with Min and Max Date Validation as following - Datepicker.TS code - //App/datepicker.ts import { Component } from '@angular/core' ; /** Datepicker with min date & max date validation */ @ Component ({   selector: 'datepicker' ,   templateUrl: 'datepicker.html' ,   styleUrls: [ 'datepicker.css' ], }) export class Datepicker {   minDate = new Date ( 2017 , 0 , 1 );   maxDate = new Date ( 2019 , 0 , 1 ); } And Datepicker.HTML code - //App/datepicker.h...

Angular 5 Datepicker Form Controls - Material Tutorials

Datepicker allows us to enter a date as input text or pick a date from calendar and the datepicker example looks like - datepicker-example.ts - import { Component } from '@angular/core' ; @ Component ({   selector : 'datepicker' ,   template : `<mat-form-field>   <input matInput [matDatepicker]="datePicker" placeholder="Pick date">   <mat-datepicker-toggle matSuffix [for]="datePicker"></mat-datepicker-toggle>   <mat-datepicker #datePicker></mat-datepicker> </mat-form-field>` }) export class DatepickerExample {} And the NgModule import { NgModule } from '@angular/core' ; import { CdkTableModule } from '@angular/cdk/table' ; import { HttpClientModule } from '@angular/common/http' ; import { FormsModule , ReactiveFormsModule } from '@angular/forms' ; import { HttpModule } from '@angular/http' ; import ...