Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Directive could not find parent directive's controller on AngularJS 1.2.0 when replace property is set to 'true'  #4935

@psysp

Description

@psysp

Hello

While upgrading an application from AngularJS version 1.1.5 to 1.2.0 I ran into some issues which are related to inter-directive communication, done via directive's controller. In the application there's a parent directive and a child directive. At a certain point the child directive has to call a method of its parent directive's controller. Therefore the parent directive is marked as required in the child directive. One specialty about this scenario is that the parent directive uses a template which contains an ng-include directive to dynamically load a template which uses the child directive.

When running on version 1.2.0 the child directive throws an error with the following message: "Controller 'xxx', required by directive 'yyy', can't be found!"
After debugging and some more investigation I think the problem is related to the ng-include directive, but I'm not 100% sure why it doesn't work any more with version 1.2.0.

I managed to reproduce the problem on Plunker : http://plnkr.co/edit/COAkdNCYuMhpaHsWFopx

In the example I currently use version 1.2.0 so it won't work but you can easily switch to version 1.1.5 to see how it should work.

The error only happens when the 'replace' variabel is set to 'true'. If it is set to 'false' everything works as expected.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions