Datepicker in ionic Framework


Datepicker in ionic Framework : Datepicker is common plugin which is used mostly in many applications. You can use Datepicker in ionic by adding cordova-plugin-datepicker available at – https://github.com/VitaliiBlagodir/cordova-plugin-datepicker. We are going to explain the steps to add datepicker in ionic framework.


Installing plugin for Datepicker in ionic Framework

Here are steps to install the datepicker cordova-plugin-datepicker –

First Install Datepicker from Ionic CLI

Install Datepicker from Ionic CLI

cordova plugin add cordova-plugin-datepicker

Run the above command to install the plugin.

Create function to call datepicker –

Install Datepicker from Ionic CLI

 $scope.MyDatePicker = function($event) {
        var options = {
            date: new Date(),
            mode: 'date'
        };
        datePicker.show(options, function(date){
            if(date != 'Invalid Date') {
                console.log("Date came" + date);
            } else {
                console.log(date);
            }
        });
        $event.stopPropagation();  
    };

Advertisements

Add Comment

📖 Read More