简体   繁体   English

找不到指令所需的AngularJS控制器

[英]AngularJS controller, required by directive, can't be found

I have an error for each "message" 每个“消息”都有错误

Error: [$compile:ctreq] Controller 'accordion', required by directive 'accordionGroup', can't be found!

with my code in html 用我的HTML代码

<h2 data-ng-if="!!messageData.messages.length">Messages</h2>

<accordion close-others="true">
    <accordion-group data-ng-repeat="m in messageData.messages">
        <accordion-heading>
            <span>{{ m.head }}</span>
            <span class="pull-right">{{ m.created | date:'d-MMM-yyyy HH:mm' }}</span>
        </accordion-heading>
        <p>{{ m.body }}</p>
    </accordion-group>
</accordion>

but messages are views with no problems 但是消息是没有问题的视图

UPD 1: i tried to debug angular.js and function getControllers return different values for "empty accordion-group" and "accordion-group with ng-repeat", difference is in line UPD 1:我尝试调试angular.js,并且getControllers函数为“空手风琴组”和“具有ng-repeat的手风琴组”返回不同的值,但差异在一行

value = value || $element[retrievalMethod]('$' + require + 'Controller');

value is undefined for "ng-repeat acordion-group" and not null for "empty accordion group" “ ng-repeat acordion-group”的值是未定义的,“空手风琴组”的值不是null

UPD COMPLETE I'm update my VS2013 to RC2 and problems solved. UPD COMPLETE我将VS2013更新为RC2,问题已解决。

Thank you for having the time to provide a plunkr. 感谢您抽出宝贵的时间为您提供插件。 I modified it a bit by excluding the non-needed libs and also using data-ng-xx notation. 我通过排除不需要的库以及使用data-ng-xx表示法对它进行了一些修改。 I also used the appropriate way of injecting scope: 我还使用了适当的注入范围的方法:

['$scope', function($scope){
....
}]

I also put ng-app on body and after head cause of a possible script loading order issue. 我还将ng-app放在正文上,然后放在可能导致脚本加载顺序问题的头后面。 Here is the Plunkr: 这是Plunkr:

http://plnkr.co/edit/Rftdxz4erSeHT14cp2ID?p=preview http://plnkr.co/edit/Rftdxz4erSeHT14cp2ID?p=preview

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到指令“ loginForm”所需的控制器“ alertForm”! 在angularjs中 - Controller 'alertForm', required by directive 'loginForm', can't be found! in angularjs 无法找到指令&#39;ngSwitchWhen&#39;所需的AngularJS控制器&#39;ngSwitch&#39; - AngularJS Controller 'ngSwitch', required by directive 'ngSwitchWhen', can't be found AngularJS错误:指令“ drawing”所需的控制器“ drawing”找不到 - AngularJS Error: Controller 'drawing', required by directive 'drawing', can't be found AngularJS指令找不到所需的控制器 - AngularJS directive can't find required controller 无法找到指令所需的控制器 - Controller Required By Directive Can't Be Found 无法找到指令&#39;...&#39;所需的控制器&#39;ngModel&#39; - Controller 'ngModel', required by directive '…', can't be found 无法找到指令'...'所需的控制器'ngModel' - Controller 'ngModel', required by directive '…', can't be found Angularjs:错误:[$compile:ctreq] 指令“ngTransclude”所需的控制器“carousel”,无法找到 - Angularjs: Error: [$compile:ctreq] Controller 'carousel', required by directive 'ngTransclude', can't be found 无法在包含内容中找到指令所需的Angularjs控制器 - Angularjs controller required by directive can not be found in transclude content 调节器 <directiveName> ,指令“ ngClass”要求,找不到 - Controller <directiveName>, Required by Directive 'ngClass', Can't be Found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM