I am using the material design date picker
<md-content flex class="padding-top-0 padding-bottom-0" layout="row">
<md-datepicker ng-model="user.submissionDate" md-placeholder="Start date" flex ng-click="ctrl.openCalendarPane($event)"></md-datepicker>
<md-datepicker ng-model="user.submissionDate" md-placeholder="Due date" flex></md-datepicker>
</md-content>
and its shows the UI like this
I want to remove the calendar icon and include the ng-click functionality in the input box.
How to bind the runtime event with the input box?
css
<style>
.inputdemoBasicUsage .md-datepicker-button {
width: 36px; }
.inputdemoBasicUsage .md-datepicker-input-container {
margin-left: 2px;
}
.md-datepicker-input-container{
display:block;
}
.md-datepicker-input[placeholder]{
color=red;
}
.padding-top-0{
padding-top:0px;}
.padding-bottom-0{
padding-bottom:0px;
}
</style>
Additional to @EmirMarques answer, I wanted to make the input field read only. so i added this code. Here user can't edit the date input field. so its
$scope.initDatepicker = function(){
angular.element(".md-datepicker-button").each(function(){
var el = this;
var ip = angular.element(el).parent().find("input").bind('click', function(e){
angular.element(el).click();
});
angular.element(el).parent().find("input").prop('readonly', true);
angular.element(this).css('visibility', 'hidden');
});
};
And this CSS made the look better
.md-datepicker-input-container {
display: block;
margin-left: 0 !important;
width: 100% !important;;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With