Here's a low-tech solution - pass the template in as an attribute:
http://plnkr.co/edit/CjtbiY5CSs5vQ0IFk20N?p=preview

I initially tried element.parent(), but that just reports the directive 
that called the template.

Sander's solution should work if you are able to re-work the way you are 
using templates, though.

Dave

On Friday, March 7, 2014 4:49:59 AM UTC-5, Alexandre Tiertant wrote:
>
> Hi Elias,
>
> once again,i didn't explain my probleme correctly,an exemple could be more 
> clear :
>   <script type="text/ng-template" id="/templateName.html">
>     <my-directive>content</my-directive>
>   </script>
>
> in this sample,i would like to get "/templateName.html" in the 
> my-directive compile function.
>
> thanks for your help!
>
> Le vendredi 7 mars 2014 10:37:34 UTC+1, Sander Elias a écrit :
>>
>> Alexandre,
>>
>> If it a directive build by yourself? ifo so, it’s really easy.
>>
>>     app.directive('seSample', [
>>         function () {
>>
>>             var DDO = {
>>                 restrict: 'E',
>>                 templateUrl : 'views/template.tpl.html'
>>             };
>>
>>             DDO.link = function (scope) {
>>                 scope.getTemplateUrl = function () {
>>                     return DDO.templateUrl;
>>                 };
>>             };
>>
>>             return DDO; // return the Directive Description Object.
>>         }
>>     ]);
>>
>> If it’s not yours, I think it is possible, but a bit more involved.
>>
>> 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/d/optout.

Reply via email to