Amila Sampath
Amila Sampath

Reputation: 645

How to add a "datetime" picker for angular js application?

I am developing an angular js application. It's has one page, with an input as date. I need to add, a date as input.

Date Input

<input type="date" ng-model="InputDate" />

How can I do that?

Upvotes: 2

Views: 20133

Answers (2)

r0u9hn3ck
r0u9hn3ck

Reputation: 553

If you want a simple solution, considering you don't want to inject additional dependency just for a date-time picker in your application, go with the inbuilt method:

<input type="datetime-local" id="exampleInput" name="input" ng-model="example.value"
  placeholder="yyyy-MM-ddTHH:mm:ss" min="2001-01-01T00:00:00" max="2013-12-31T00:00:00" required />

More information on date-time picker | AngularJS API Reference

However, if your app requires date-time input in multiple views, then maybe you can also go with other, additional third party modules (just google for it). One of the major advantage of going this way would be to let your app users encounter a better UI/UX.

Upvotes: 9

You can use Angular Bootstrap components : https://angular-ui.github.io/bootstrap/#/datepicker

Upvotes: 4

Related Questions