From dbde7c4eb9f476c237278e55403fc1fd74035edb Mon Sep 17 00:00:00 2001 From: Jhalak Date: Wed, 1 Jul 2015 10:50:11 +0600 Subject: [PATCH] Fixed ngModel issue when its used as inline. When this directive was used with inline option, the ngModel variable was not updating after selection of date/time. - Fixed the directive so that we can get updated value in ngModel variable after selection. - Updated example.html to show how to use inline with ngModel. This may be not the best approach to fix the issue, but its just a quick fix for those who want to use it right way. --- angular-bootstrap-datetimepicker-directive.js | 6 +++++- example.html | 10 ++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/angular-bootstrap-datetimepicker-directive.js b/angular-bootstrap-datetimepicker-directive.js index eb4ffa6..9ff5348 100644 --- a/angular-bootstrap-datetimepicker-directive.js +++ b/angular-bootstrap-datetimepicker-directive.js @@ -41,7 +41,11 @@ angular .on('dp.change', function (e) { if (ngModelCtrl) { $timeout(function () { - ngModelCtrl.$setViewValue(e.target.value); + if (options.inline) { + ngModelCtrl.$setViewValue($(e.target).find('input').val()); + } else { + ngModelCtrl.$setViewValue(e.target.value); + } }); } }) diff --git a/example.html b/example.html index 7e280f0..b2e9ae2 100644 --- a/example.html +++ b/example.html @@ -206,12 +206,14 @@

- +
-
-
+
+ +