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

18,117

Solution 1

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

Solution 2

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.

Share:
18,117
Amila Sampath
Author by

Amila Sampath

Enjoy with #nodejs#angularjs#mongodb#javascript#HTML5#Css#JavaScript#JWT#Ionic#Firebase#Jira#Git#Bitbucket#

Updated on June 12, 2022

Comments

  • Amila Sampath
    Amila Sampath almost 2 years

    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?