Skip to content

Commit 4448d55

Browse files
author
soocheng
committed
fix #119
fix month not updated due to scope problem
1 parent c6974d6 commit 4448d55

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

dist/ionic-datepicker.bundle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ionic-datepicker-modal.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ <h1 class="title">{{selctedDateEpoch | date : mainObj.dateFormat}}</h1>
1616
<div class="col-50 padding_right_5px">
1717
<label class="item item-input item-select month_select">
1818
<span class="input-label">&nbsp;</span>
19-
<select ng-model="currentMonth" ng-change="monthChanged(currentMonth)">
20-
<option ng-repeat="month in monthsList" ng-selected="month == currentMonthSelected" value="{{month}}">
19+
<select ng-model="data.currentMonth" ng-change="monthChanged(data.currentMonth)">
20+
<option ng-repeat="month in monthsList" ng-selected="month == data.currentMonthSelected" value="{{month}}">
2121
{{month}}
2222
</option>
2323
</select>

src/ionic-datepicker-popup.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<div class="col-50 padding_right_5px">
1313
<label class="item item-input item-select month_select">
1414
<span class="input-label">&nbsp;</span>
15-
<select ng-model="currentMonth" ng-change="monthChanged(currentMonth)">
16-
<option ng-repeat="month in monthsList" ng-selected="month==currentMonthSelected" value="{{month}}">
15+
<select ng-model="data.currentMonth" ng-change="monthChanged(data.currentMonth)">
16+
<option ng-repeat="month in monthsList" ng-selected="month==data.currentMonthSelected" value="{{month}}">
1717
{{month}}
1818
</option>
1919
</select>
@@ -22,7 +22,7 @@
2222
<div class="col-50 padding_left_5px">
2323
<label class="item item-input item-select year_select">
2424
<span class="input-label">&nbsp;</span>
25-
<select ng-model="currentYear" ng-change="yearChanged(currentYear)" ng-options="year for year in yearsList"></select>
25+
<select ng-model="data.currentYear" ng-change="yearChanged(data.currentYear)" ng-options="year for year in yearsList"></select>
2626
</label>
2727
</div>
2828
</div>

src/ionic-datepicker.provider.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ angular.module('ionic-datepicker.provider', [])
4444
$scope.currentDate.setFullYear($scope.currentDate.getFullYear());
4545
}
4646
$scope.currentDate.setMonth($scope.currentDate.getMonth() - 1);
47-
$scope.currentMonth = $scope.mainObj.monthsList[$scope.currentDate.getMonth()];
47+
$scope.data.currentMonth = $scope.mainObj.monthsList[$scope.currentDate.getMonth()];
4848
$scope.data.currentYear = $scope.currentDate.getFullYear();
4949
refreshDateList($scope.currentDate);
5050
};
@@ -56,7 +56,7 @@ angular.module('ionic-datepicker.provider', [])
5656
}
5757
$scope.currentDate.setDate(1);
5858
$scope.currentDate.setMonth($scope.currentDate.getMonth() + 1);
59-
$scope.currentMonth = $scope.mainObj.monthsList[$scope.currentDate.getMonth()];
59+
$scope.data.currentMonth = $scope.mainObj.monthsList[$scope.currentDate.getMonth()];
6060
$scope.data.currentYear = $scope.currentDate.getFullYear();
6161
refreshDateList($scope.currentDate);
6262
};
@@ -154,9 +154,9 @@ angular.module('ionic-datepicker.provider', [])
154154
$scope.rows = [0, 7, 14, 21, 28, 35];
155155
$scope.cols = [0, 1, 2, 3, 4, 5, 6];
156156

157-
$scope.currentMonth = $scope.mainObj.monthsList[currentDate.getMonth()];
157+
$scope.data.currentMonth = $scope.mainObj.monthsList[currentDate.getMonth()];
158158
$scope.data.currentYear = currentDate.getFullYear();
159-
$scope.currentMonthSelected = angular.copy($scope.currentMonth);
159+
$scope.data.currentMonthSelected = angular.copy($scope.data.currentMonth);
160160
$scope.currentYearSelected = angular.copy($scope.data.currentYear);
161161
$scope.numColumns = 7;
162162
}

0 commit comments

Comments
 (0)