You can create an Angular 4 DateRangePicker component with minimal code configuration using this quick start project.
Angular 4 DateRangePicker
The following section explains the steps required to create a simple Angular 4 DateRangePicker component.
Make sure that you have the following compatible versions of TypeScript and Angular in your machine before starting to work on this project:
The Angular 4 DateRangePicker used in this project is created from the Syncfusion ej2-angular-calendars package. You can simply define it as <ejs-daterangepicker> within the template.
Creating Angular Project
Install the Angular CLI application in your machine.
Now, create a new Angular project using the ng new command and navigate to that folder.
Install the ej2-angular-calendars package using the npm install command.
Adding Angular 4 DateRangePicker
You can add the Angular 4 DateRangePicker component using the ejs-daterangepicker directive and the attributes within the tag, which allows you define other functionalities.
Import the DateRangePicker module into Angular application(app.module.ts) from the ej2-angular-calendars package.
Define the Angular DateRangePicker code within the app.component.html file mapped against the templateUrl option in the app.component.ts file.
Here, the DateRangePicker component is rendered using the startDate and endDate properties.
Refer the CDN link of CSS reference within the index.html file.
Run the application with the ng serve command, and the DateRangePicker will be displayed with start and end dates on the browser as shown below.
This page will automatically be redirected to the sign-in page in 10 seconds.