简体   繁体   中英

How to call a function on click of date in html 5 datepicker input type

I had a html5 date-time picker.Now on mouseclick(select) of date from date picker I want to call a function.I wonder how can we do that in angular js...can someone help me.

html:

 <div class="col-lg-4">
 <input class="form-control" type="datetime" date-time auto-close="true" view="date" 
  min-view="date" format="dd/MM/yyyy" ng-model="$root.Details.date" value = "{{dob}}">
 </div>

Js

class CreateCustomerCtrl {
constructor($scope,$rootScope,$http,$state,$reactive,$timeout,Notification)
{

//logic here
}
export default angular.module('createCustomer', [
angularMeteor
])
.component('newCustomer', {
templateUrl: 'client/customer/new-customer.html',
 controller:['$scope','$rootScope','$http','$state','$reactive','$timeout','Notification'
,customerCtrl]});

So on select of date I want to call a function. Thanks在此处输入图像描述

You should try <input type="date" onchange="return function(this) />;" and return your function to do whatever you want to.

您可以在输入时使用ng-change="yourFunc()"事件,并使用ng-model="myDate"绑定值,并在内部函数中放置逻辑。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM