Directive's controller not inheriting properly; Accordion; custom build v10 & v11
I'm using an accordion and getting this error:
"Error: [$compile:ctreq] Controller 'accordion', required by directive 'accordionGroup', can't be found!
http://errors.angularjs.org/1.3.0-beta.11/$compile/ctreq?p0=accordion&p1=accordionGroup
minErr/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:78
getControllers@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:6582
nodeLinkFn@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:6753
compileTemplateUrl/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:6957
$http/promise.success/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:8070
qFactory/defer/deferred.promise.then/wrappedCallback@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:11443
qFactory/defer/deferred.promise.then/wrappedCallback@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:11443
qFactory/ref/<.then/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:11529
$RootScopeProvider/this.$get</Scope.prototype.$eval@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:12620
$RootScopeProvider/this.$get</Scope.prototype.$digest@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:12424
$RootScopeProvider/this.$get</Scope.prototype.$apply@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:12724
module.exports/</<.link/processRiver/<@https://localhost/_serveDev/code/bartr/directives/river/wjRiver.iced?ts=1402516098708&pathPrefix=bartr:22
forEach@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:327
module.exports/</<.link/processRiver@https://localhost/_serveDev/code/bartr/directives/river/wjRiver.iced?ts=1402516098708&pathPrefix=bartr:16
module.exports/</<.link/<@https://localhost/_serveDev/code/bartr/directives/river/wjRiver.iced?ts=1402516098708&pathPrefix=bartr:33
$RootScopeProvider/this.$get</Scope.prototype.$broadcast@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:12905
module.exports/</<@https://localhost/_serveDev/code/bartr/services/eventStation/serviceStation.iced?ts=1402516098708&pathPrefix=bartr:147
$RootScopeProvider/this.$get</Scope.prototype.$broadcast@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:12905
module.exports/</<@https://localhost/_serveDev/code/bartr/services/eventParse/delivAnswerParse.iced?ts=1402516098708&pathPrefix=bartr:29
$RootScopeProvider/this.$get</Scope.prototype.$broadcast@https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.js:12905
module.exports/</<@https://localhost/_serveDev/code/bartr/services/eventParse/eventsGrandCentral.iced?ts=1402516098708&pathPrefix=bartr:21
EventEmitter.prototype.emit@https://localhost/_serveDev/system?ts=1402516098708:3033
module.exports/<@https://localhost/_serveDev/system?ts=1402516098708:3421
EventEmitter.prototype.emit@https://localhost/_serveDev/system?ts=1402516098708:3033
module.exports/<.connect/sock.onmessage@https://localhost/_serveDev/system?ts=1402516098708:3545
Socket.prototype.onPacket@https://localhost/_serveDev/system?ts=1402516098708:1070
Socket.prototype.setTransport/<@https://localhost/_serveDev/system?ts=1402516098708:914
EventEmitter.prototype.emit@https://localhost/_serveDev/system?ts=1402516098708:568
Transport.prototype.onPacket@https://localhost/_serveDev/system?ts=1402516098708:1361
Transport.prototype.onData@https://localhost/_serveDev/system?ts=1402516098708:1353
WS.prototype.doOpen/this.socket.onmessage@https://localhost/_serveDev/system?ts=1402516098708:2451
" "<div heading="{{trout2.name}}" class="panel panel-default ng-isolate-scope">"
I'll make a Plunker tomorrow.
I think it may be because I'm compiling the directives which contain the accordion directiives and then appending them, all within a directive. So have some conjecture maybe should be making more advanced use of the $compile function. I'll figure it out + close issue and/or post Plunker in the morning. thx!
I'm closing this as figured the cause out.
I had the accordion tag in one directive, which then appended another directive containing accordion-groups to itself. Something wasn't lining up just right, so it couldn't find controller.
Thanks!
Can you please make a plunker? Or show how you fixed it?
In my working implementation, both of my custom directives are used as E elements, they are not modifications of the accordion and filler stuff. The accordion and associated filler stuff e.ge accordion-group just go in those parent and child templates. The parent's in particular is so short it could probably does'nt even need a separate file and could just be defined in the directive definition with that option I forget the name of ... but I haven't tried that.
In the parent directive's template (Jade in my case) accordion(close-others='true') is the whole file.
In the child directive's template,
accordion-group(heading="{{stuff}}")
.panel.panel-success
.panel-heading {{stuff}}
.panel-body
.division
is the gist of it. Then, in the parent link function to render: (coffee-script)
sparc= element.find "accordion"
strang= "<child-directive somestuff='stuff'></child-directive>"
$compile(strang) scope, (nodes)->
sparc.append nodes
I hope that helps.Good luck!