<div ng-show="discount.discount.days_details.monday.enable" class="add-time-block" ng-class="showInterval"> <button ng-click="discount.addInterval('monday', start_m, end_m);" class="edit blue">{{::discount.lc.b_add_period}} </button> <div class="input-group bootstrap-timepicker"> <input type="time" placeholder="hrs:mins" ng-model="start_m" value="00:00" pattern="^([0-1]?[0-9]|2[0-4]):([0-5][0-9])(:[0-5][0-9])?$" class="timepicker-rest-from"> <strong>-</strong> <input type="time" placeholder="hrs:mins" ng-model="end_m" value="00:00" pattern="^([0-1]?[0-9]|2[0-4]):([0-5][0-9])(:[0-5][0-9])?$" class="timepicker-rest-to"> </div> <div> <span ng-repeat="interval in discount.discount.days_details.monday.intervals">{{::interval.from}} - {{::interval.to}}<br></span> </div> </div> 

The bottom line is that I use angular-bootstrap-datepicker and only version angular 1.3.5 is compatible with it, but because of this, ng-model does not work correctly. As a result, start_m and start_end will be undefined .
I cannot change the datepicker to another one, because everything is on the website by layout.
But if you put angular above 1.3.5 , for example, 1.4.9 , then there will be such an error

 Controller 'select', required by directive 'ngOptions', can't be found! 
 <div id="datepicker0" ng-datepicker dp-options="discount.datepickersOptions.from" ng-model="discount.discount_dates.from"></div> 

How can this problem be solved ?

I will attach the link to ng-bootstrap-datepicker

  • Can you make a minimal example that you can run and see the error you are talking about? - Grundy
  • and add a link to the component ng-bootstrap-datepicker you use - Grundy
  • hmm, and on what element do you have the ng-datepicker ? Something in the markup in the question I can not find - Grundy
  • Added datepicker template - jashka
  • and then the previous markup whose? - Grundy

2 answers 2

The solution to this issue is and I think that is not very correct, but it solves the problem:
We go at angular-bootstrap-datepicker
in the ngDatepicker directive, ngDatepicker change the scope ngOptions to dpOptions . And where ngOptions used

  • so ng-bootstrap-datepicker or angular-bootstrap-datepicker ? - Grundy
  • link is better in a question transfer - Grundy
  • angular-bootstrap-datepicker - got the name of the module with the name of the component - jashka
  • it seems that you did not solve the problem, but simply removed the options and now they are simply used by default, and not the ones that you ask - Grundy
  • So now I’ll use dp-options as a directive and will pass the same parameters - jashka

Use as an ng-model not a single parameter, but an object of the form date = {start_m : '', end_m: ''} and in the template ng-model = "date.start_m" .