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.

Datepicker - does not open more than once when part of an ng-include #2584

@zackarychapple

Description

@zackarychapple

I was having an issue where a datepicker element would only open once on a page, and after closing it would not open again for that particular element.

When using the below html on a view the datepicker can open more than once. However when the html is included via a ng-include the datepicker only opens once.

Here is a plunker showing how it is broken.
http://plnkr.co/edit/AboEJGxAK3Uz76CfpaZ0?p=preview

<div class="row">
  <div class="col-md-2">
    <p class="input-group">
      <input type="text" class="form-control" datepicker-popup="yyyy/MM/dd" ng-model="something.dt2" is-open="secondCal"
         min-date="minDate" name="secondCal" max-date="'2015-06-22'" datepicker-options="dateOptions"
         date-disabled="disabled(date, mode)" ng-required="true" close-text="Close"/>
        <span class="input-group-btn">
          <button type="button" class="btn btn-default" style="line-height: 1.2em" ng-click="open($event, 'secondCal')">
            <i class="ss-icon ss-calendar"></i>
          </button>
        </span>
    </p>
  </div>
</div>

Here is the javascript I have in my controller.

 $scope.open = function ($event, elementOpened) {
      $event.preventDefault();
      $event.stopPropagation();

      $scope[elementOpened] = !$scope[elementOpened];
  };

Here is the html for my ng-include.

<div ng-include src="'dist/partials/myPartial.html'"></div>

Also does not work with this type of ng-include.

<div ng-include="'dist/partials/myPartial.html'"></div>

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