Angular DatePicker - Multiple directives > [datepicker, datepicker]

情到浓时终转凉″ 提交于 2019-12-23 22:22:34

问题


I'm trying to use the 720Kb datepicker. https://github.com/720kb/angular-datepicker

While using the simple example :

<datepicker>
  <input ng-model="date" type="text"/>
</datepicker>

I'm getting the blow error:

angular.js:11655 Error: [$compile:multidir] Multiple directives [datepicker, datepicker] asking for new/isolated scope on: http://errors.angularjs.org/1.3.15/$compile/multidir?p0=datepicker&p1=datep…epicker%20class%3D%22datepicker%22%20date-format%3D%22dd%2FMM%2Fyyyy%22%3E at angular.js:63

I noticed that if I'm changing the name of the directive in the src file for example to datepickercust the above example will work (with changing the tags).

<datepickercust >
  <input ng-model="date" type="text"/>
</datepickercust>

Also , if I'm trying the same example by changing the 'datepicker' tags to 'div' tags , and adding class='datepicker' it works fine.

  <div class="datepicker">
      <input ng-model="date" type="text"/>
  </div>

I just can't understand what's going on here... why the original example not working ?

Thanks in advance.


回答1:


Issue found.

Looks like UI Bootstrap still contain 'datepicker' directive which is deprecated and causing this issue .

Now need to see how I can work with both .

Thanks all.




回答2:


Check if there are two datepicker directives with the same name and do check what formation they allow like tag, element or attribute etc.



来源:https://stackoverflow.com/questions/34373901/angular-datepicker-multiple-directives-datepicker-datepicker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!