Thanks Sander, a friend just gave me the solution : when using $compile we 
can pass a third argument that gives the controller. 

We now have : var tpl = $compile('<item></item>')(scope, null, {container: 
iElement.data('$containerController')});

Updated plunker with workin controller 
: http://plnkr.co/edit/lhgRXfCdkWefFfxz10Ja?p=preview

Cheers :)

On Monday, February 10, 2014 5:28:38 AM UTC+1, Sander Elias wrote:
>
> Hi Julien,
>
> Yes, I have an idea, the included elements are children directly to the 
> container element. They can find the "^container".
> when the dust is settled, and everything is in place, you add another 
> <item>, but this time, it is added to the second div inside your container.
> That div doesn't have an controller, so the "^container" does not resolve 
> there! for some reason the "^container" only looks up 1 'level' in the dom 
> tree.
> You can use the angular.element.inheritedData('$containerController') to 
> find the controller you need.
> see: http://plnkr.co/edit/jxcSYmTctqVcWl0rpM5J?p=preview
>
> Regards
> Sander
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to