javascript - js出现错误: [$compile:multidir] using Angular.

标签 javascript angularjs datepicker

我在使用 Angular.js 的日期选择器时收到以下错误。

错误信息

Error: [$compile:multidir] http://errors.angularjs.org/1.4.6/$compile/multidir?p0=datepicker&p1=&p2=da…-prev%3D%22%3Ci%20class%3D%26quot%3Bfa%20fa-arrow-circle-left%26quot%3B%3E
    at Error (native)
    at http://oditek.in/Gofasto/js/angularjs.js:6:416
    at Q (http://oditek.in/Gofasto/js/angularjs.js:69:353)
    at D (http://oditek.in/Gofasto/js/angularjs.js:62:492)
    at http://oditek.in/Gofasto/js/angularjs.js:68:182
    at http://oditek.in/Gofasto/js/angularjs.js:118:334
    at n.$eval (http://oditek.in/Gofasto/js/angularjs.js:132:452)
    at n.$digest (http://oditek.in/Gofasto/js/angularjs.js:129:463)
    at n.$apply (http://oditek.in/Gofasto/js/angularjs.js:133:236)
    at g (http://oditek.in/Gofasto/js/angularjs.js:87:376)

我在下面解释我的代码。

<div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-right" style="width:180px">Date :</span>
<datepicker date-format="dd-MM-y" button-prev='<i class="fa fa-arrow-circle-left"></i>' button-next='<i class="fa fa-arrow-circle-right"></i>'> 
<input type="text" name="birthdate" class="form-control" ng-model="date" placeholder="Add date" />
</datepicker>
</div> 

我已经包含了 720kb.datepicker 模块并添加了相应的 css 和 js 文件。但我仍然收到上述类型的错误。

请帮助我解决此错误。

最佳答案

Angularjs 正在导出一个 url 来解释错误消息

https://docs.angularjs.org/error/$compile/multidir?p0=datepicker&p1=&p2=da%E2%80%A6-prev%3D%22%3Ci%20class%3D%26quot;fa%20fa-arrow-circle-left%26quot;%3E

根据您的情况和说明找到您的上一个按钮定义。

Multiple directives [datepicker, da…-prev="{3}] asking for {4} on: {5}

Description This error occurs when multiple directives are applied to the same DOM element, and processing them would result in a collision or an unsupported configuration.

To resolve this issue remove one of the directives which is causing the collision.

Example scenarios of multiple incompatible directives applied to the same element include:

Multiple directives requesting isolated scope. Multiple directives publishing a controller under the same name. Multiple directives declared with the transclusion option. Multiple directives attempting to define a template or templateURL.

很可能 button-prevbutton-nextdatepicker 指令重叠。

关于javascript - js出现错误: [$compile:multidir] using Angular.,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33734478/

相关文章:

javascript - HTML 中的嵌套文本链接

javascript - 冗余功能。如何以另一种方式返回响应?

javascript - 在node.js下运行UglifyJS产生找不到模块错误

javascript - AngularJS 和动态 HTML

javascript - PhoneGap 2.0 (Cordova) DatePicker 插件 'mode' - 获取日期和时间的属性

jquery - 根据日期选择器日期范围验证从文本框中输入的日期

JavaScript:将输入元素添加到当前 div

javascript - 如何在 angular.js 中创建多选按钮

javascript - 缩小的 AngularJS 给了我不可读的错误

javascript - 在日期选择器中隐藏日期