In my page, I have three angular-moment-datepicker fields - a date picker field, a month picker field, and a year picker field respectively. Here is the code:
<input class="form-control" placeholder="BY DAY" ng-model="date" moment-picker="gDate" start-view="month" format="MM/DD/YYYY" today="true" ng-model-options="{ updateOn: 'blur' }" change="getData('day')" />
<input class="form-control" placeholder="BY MONTH" ng-model="month" moment-picker="gMonth" format="MM/YYYY" ng-model-options="{ updateOn: 'blur' }" change="getData('month')" />
<input class="form-control" placeholder="BY YEAR" ng-model="year" moment-picker="gYear" format="YYYY" ng-model-options="{ updateOn: 'blur' }" change="getData('year')" />
And here is the corresponding Angular function:
$scope.getData = function(Level) {
//Function logic here
}
When selecting a date, I want to clear the month and year fields. However, this process triggers the ng-change event simultaneously for 'month' and 'year', leading to unexpected behavior and not displaying the selected value in the text field.
I tried using the following alternative function within the text fields:
$scope.checkForDateType = function() {
//Logic to check date type
}
Unfortunately, the issue persists despite trying this approach. Any assistance on resolving this problem would be greatly appreciated.