angularjs - Why is the datepicker opening automatically? -
with below code, datepicker open , don't see input area:
html:
<td ng-controller="notificationmodalcontroller"> <span><strong>end date</strong></span> <input type="text" name="notification.text" ng-model="notification.text" datepicker=""> </td>
js:
app.directive('datepicker', function () { return { require: 'ngmodel', link: function (scope, el, attr, ngmodel) { $(el).datepicker({ autoclose:true, onselect: function (datetext) { scope.$apply(function () { ngmodel.$setviewvalue(datetext); }); } }); } }; });
i'm using theme in case matters:
http://wrapbootstrap.com/preview/wb0t41tx4
why datepicker open? i'd behave 1 in theme sample closest i've gotten:
the bootstraper datepicker dont provide method onselect. try instead:
el.datepicker({ startdate: new date(), format: 'dd.mm.yyyy', autoclose: true }).on('changedate', function (e) { somevar = e.date; });
Comments
Post a Comment