Transclusion confusion. Nested directive doesn't work

I've got a problem nesting two directives. This code with one directive works as expected: http://plnkr.co/edit/nq1DD0

But when I wrap this directive into another one with transclusion the access to the controller scope breaks: http://plnkr.co/edit/zaWDQxqeFe9aYIBPnpJ3

What's wrong with it?

Thanks in advance for the help!

Ksenia

I've fixed your plunker, see my fork here: http://plnkr.co/edit/ul4HcAoopJjdcj7dXFYt?p=preview

There were few problems with your implementation:

  1. In the autocomplete you were chaning the selection object and not its properties
  2. scope.$watch was not well defined in the emptyverifier

In overall you should avoid using the same names for value/attributes/properties etc, the "selection" keyword is used all over the place so it quite a challenge to understand the code;) I've only fixed the bindings and selection part... haven't touched the logic that should show the "empty message" - you should try to handle "change" event of the autocomplete plugin.