angularjs - Angular UI datepicker not updating -
I have tried to expand the UI datepicker with the previous and next day.
As you can see from Plunker I can change the model using either datepicker or previous / next button but when the model turns with the previous / next button, the datepicker is not updated .
& lt; Div class = "form-group" & gt; & Lt; Div class = "input-group" & gt; & Lt; Input type = "text" class = "form-control" datepicker-popup = "{{ctrl.format}}" ng-model = "ctrl.dt" is-open = "ctrl.opened" datepicker-options = "Ctrl .dateOptions "ng-required =" true "close-text =" close "/> & Lt; Span class = "input-group-btn" & gt; & Lt; Button type = "button" class = "btn btn-default" ng-click = "ctrl.open ($ event)" & gt; & Lt; I class = "glyphin glyphoen-calender" & gt; & Lt; / I & gt; & Lt; / Button & gt; & Lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt;
I have already tried several methods ($ scope and display controller as syntax) but does it not only work any ideas?
PS: I've worked very hard to focus on the next button in the last button, daypeaker, one button, centered, the délyapter has just captured it in the required position. If someone has an idea how to complete it, then any help is appreciated.
I do not know why, but it seems that when ngmodel changes the date object itself, then no response But it has changed that you allocate new instances of the date of scope.
Try this:
this.prevDay = function () {this.dt = getPrevNextDate (this .dt, -1); }; This.nextDay = function () {this.dt = getPrevNextDate (this.dt, 1); }; Function getPrevNextDate (date, increment) {var newDate = new date (); NewDate.setDate (date.getDate (+ + increments); Return new date; }
and to
cache in some variables such as var self = this
at the top of the controller function and use Instead of self
this
, you will avoid error in this line:
$ log.log (' GET api
Comments
Post a Comment