Skip to content

Commit

Permalink
Move DOM manipulation to the link function of the appropriate directive.
Browse files Browse the repository at this point in the history
  • Loading branch information
backnol committed Oct 7, 2015
1 parent 5ac3bdb commit b34ecc3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions angularjs-datetime-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@
datetimePickerEl = $compile(div)(options.scope)[0];
datetimePickerEl.triggerEl = options.triggerEl;

// Hide the time selection if dateOnly is not set.
if (options.dateOnly === '' || options.dateOnly === true){
datetimePickerEl.querySelector('#adp-time').style.display = 'none';
}

$document[0].body.appendChild(datetimePickerEl);

//show datetimePicker below triggerEl
Expand Down Expand Up @@ -183,6 +178,10 @@
scope.inputHour;
scope.inputMinute;

if (scope.dateOnly === true){
element[0].querySelector('#adp-time').style.display = 'none';
}

scope.$applyAsync( function() {
ctrl.triggerEl = angular.element(element[0].triggerEl);
if (attrs.ngModel) { // need to parse date string
Expand Down

0 comments on commit b34ecc3

Please sign in to comment.