Skip to content

Commit

Permalink
Fixing Angular 1.3 function binding issues
Browse files Browse the repository at this point in the history
Closes #68
  • Loading branch information
indrimuska committed Mar 18, 2017
1 parent 9f1db5c commit d224fdb
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-moment-picker",
"version": "0.9.8",
"version": "0.9.9",
"authors": [
"Indri Muska <[email protected]>"
],
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-moment-picker.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Angular Moment Picker - v0.9.8 - http://indrimuska.github.io/angular-moment-picker - (c) 2015 Indri Muska - MIT */
/*! Angular Moment Picker - v0.9.9 - http://indrimuska.github.io/angular-moment-picker - (c) 2015 Indri Muska - MIT */
.moment-picker {
position: relative;
display: block;
Expand Down
6 changes: 3 additions & 3 deletions dist/angular-moment-picker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Angular Moment Picker - v0.9.8 - http://indrimuska.github.io/angular-moment-picker - (c) 2015 Indri Muska - MIT */
/*! Angular Moment Picker - v0.9.9 - http://indrimuska.github.io/angular-moment-picker - (c) 2015 Indri Muska - MIT */
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
Expand Down Expand Up @@ -209,7 +209,7 @@
isSelectable: function (value, precision) {
var selectable = true;
try {
if (angular.isFunction($scope.selectable))
if (angular.isFunction($scope.selectable) && $attrs['selectable'])
selectable = $scope.selectable({ date: value, type: precision });
}
catch (e) {
Expand Down Expand Up @@ -472,7 +472,7 @@
$scope.view.moment = (newModelValue || moment().locale($scope.locale)).clone();
$scope.view.update();
$scope.view.render();
if (angular.isFunction($scope.change)) {
if (angular.isFunction($scope.change) && $attrs['change']) {
var oldModelValue_1 = utility_1.valueToMoment(oldViewValue, $scope);
$scope.$evalAsync(function () { return $scope.change({ newValue: newModelValue, oldValue: oldModelValue_1 }); });
}
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-moment-picker.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/angular-moment-picker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-moment-picker",
"version": "0.9.8",
"version": "0.9.9",
"description": "Angular Moment Picker is an AngularJS directive for date and time picker using Moment.js",
"main": "dist/angular-moment-picker.js",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions src/directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class Directive implements ng.IDirective {
isSelectable: (value: moment.Moment, precision?: moment.unitOfTime.StartOf) => {
let selectable: boolean = true;
try {
if (angular.isFunction($scope.selectable)) selectable = $scope.selectable({ date: value, type: precision });
if (angular.isFunction($scope.selectable) && $attrs['selectable']) selectable = $scope.selectable({ date: value, type: precision });
} catch (e) {
this.$log.error(e);
}
Expand Down Expand Up @@ -333,7 +333,7 @@ export default class Directive implements ng.IDirective {
$scope.view.moment = (newModelValue || moment().locale($scope.locale)).clone();
$scope.view.update();
$scope.view.render();
if (angular.isFunction($scope.change)) {
if (angular.isFunction($scope.change) && $attrs['change']) {
let oldModelValue = valueToMoment(oldViewValue, $scope);
$scope.$evalAsync(() => $scope.change({ newValue: newModelValue, oldValue: oldModelValue }));
}
Expand Down

0 comments on commit d224fdb

Please sign in to comment.