Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.

uibDatepickerPopup directive doesn't set init value #6123

@chatoo2412

Description

@chatoo2412

Bug description:

The initial value is not set if the element is like input[type='button'] because uibDatepickerPopup only set value when date is selected: popup.js#L215

Plunker

workaround 1: add ngValue diredtive Plunker

workaround 2: create a custom directive Plunker

app.directive('uibDatepickerPopup', ($timeout) => {
  return {
    restrict: 'A',
    require: 'ngModel',
    link: (scope, element, attrs, ngModelController) => {
      if (attrs.type !== 'button') {
        return;
      }

      $timeout(() => {
        element.val(ngModelController.$viewValue);
      });
    }
  };
});

Link to minimally-working plunker that reproduces the issue:

https://plnkr.co/edit/gsPj6jiXDgKHQQqXpUfL?p=preview

Version of Angular, UIBS, and Bootstrap

Angular: 1.5.8 or lower

UIBS: 2.0.0 or lower

Bootstrap: 3.3.7 or lower

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions