i have bare bones, minimalistic app, includes in html of view
<input type="text" class="form-control" uib-datepicker-popup="{{format}}" ng-model="dt" is-open="popup1.opened" min-date="mindate" max-date="maxdate" datepicker-options="dateoptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="close" alt-input-formats="altinputformats" /> <span class="input-group-btn"> <button type="button" class="btn btn-default" ng-click="open1()"> <i class="glyphicon glyphicon-calendar"></i></button> </span>
and in controller
$scope.open1 = function() { $scope.popup1.opened=true; } $scope.popup1 ={'opened': false} $scope.dt = new date();
when click calendar icon in demo project, calendar pops open, not in full-blown project, when copy/paste code ($scope.popup1.opened change false true when clicked).
the full blown project large post - advice?
[update] help. 1 point notice code works in minmial project, not in full-blown project, regardless of suggested duplicate question.
however, have taken on board suggested duplicate an, alas, not help.
$scope.swallowclick = function($event) { if ($event.cancelable) $event.preventdefault(); $event.stoppropagation(); return false; // don't handle event further } $scope.open1 = function($event) { $scope.swallowclick($event); $scope.popup1.opened=true; return false; // don't handle event further }
have seen question , accepted answer? ui.bootstrap.datepicker is-open not working button
try passing $event ng-click handler, this...
<span class="input-group-btn"> <button type="button" class="btn btn-default" ng-click="open1($event)"> <i class="glyphicon glyphicon-calendar"></i></button> </span>
and in javascript, this...
$scope.open1 = function($event) { $event.preventdefault(); $event.stoppropagation(); $scope.popup1.opened=true; } $scope.popup1 ={'opened': false} $scope.dt = new date();
Comments
Post a Comment