{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/7466","repository_url":"https://api.github.com/repos/angular/angular.js","labels_url":"https://api.github.com/repos/angular/angular.js/issues/7466/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/7466/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/7466/events","html_url":"https://github.com/angular/angular.js/issues/7466","id":33514923,"number":7466,"title":"function templateUrl not $eval attributes?","user":{"login":"zxcabs","id":671832,"avatar_url":"https://avatars.githubusercontent.com/u/671832?v=3","gravatar_id":"","url":"https://api.github.com/users/zxcabs","html_url":"https://github.com/zxcabs","followers_url":"https://api.github.com/users/zxcabs/followers","following_url":"https://api.github.com/users/zxcabs/following{/other_user}","gists_url":"https://api.github.com/users/zxcabs/gists{/gist_id}","starred_url":"https://api.github.com/users/zxcabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zxcabs/subscriptions","organizations_url":"https://api.github.com/users/zxcabs/orgs","repos_url":"https://api.github.com/users/zxcabs/repos","events_url":"https://api.github.com/users/zxcabs/events{/privacy}","received_events_url":"https://api.github.com/users/zxcabs/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular.js/labels/resolution:%20works%20as%20expected","name":"resolution: works as expected","color":"207de5"},{"url":"https://api.github.com/repos/angular/angular.js/labels/severity:%20inconvenient","name":"severity: inconvenient","color":"006b75"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-05-14T17:36:43Z","updated_at":"2016-03-28T08:09:32Z","closed_at":"2014-05-14T22:15:33Z","body":"Hi,\r\nAttributes not $eval when use function in templateUrl.\r\n\r\nHere example:\r\n````\r\nangular\r\n    .module('app', [])\r\n    .directive('drFoo', [\r\n        function () {\r\n            return {\r\n                templateUrl: function (e, attr) {\r\n                    console.log(attr.template); // => {{ template }}\r\n                    return atrr.template;\r\n                }\r\n            };\r\n        }\r\n    ]);\r\n````\r\n````\r\n<div ng-app=\"app\" ng-init=\"template = 'foo.html'\">\r\n    <div dr-foo template=\"{{ template }}\"></div>\r\n</div>\r\n``````\r\n\r\n[jsfiddle](http://jsfiddle.net/HE4VY/1/)\r\n\r\nIt reproduced in v1.2.16 and v1.3.0-beta8"},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/202294495","html_url":"https://github.com/angular/angular.js/issues/7466#issuecomment-202294495","issue_url":"https://api.github.com/repos/angular/angular.js/issues/7466","id":202294495,"user":{"login":"gkalpak","id":8604205,"avatar_url":"https://avatars.githubusercontent.com/u/8604205?v=3","gravatar_id":"","url":"https://api.github.com/users/gkalpak","html_url":"https://github.com/gkalpak","followers_url":"https://api.github.com/users/gkalpak/followers","following_url":"https://api.github.com/users/gkalpak/following{/other_user}","gists_url":"https://api.github.com/users/gkalpak/gists{/gist_id}","starred_url":"https://api.github.com/users/gkalpak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkalpak/subscriptions","organizations_url":"https://api.github.com/users/gkalpak/orgs","repos_url":"https://api.github.com/users/gkalpak/repos","events_url":"https://api.github.com/users/gkalpak/events{/privacy}","received_events_url":"https://api.github.com/users/gkalpak/received_events","type":"User","site_admin":false},"created_at":"2016-03-28T08:09:32Z","updated_at":"2016-03-28T08:09:32Z","body":"@alexey-sh, as explained by @caitp, at the time the template/templateUrl functions are executed, there is no scope for the directive to interpolate against, thus interpolation can't help you with the template.\r\n\r\nThe reason why manual interpolation doesn't work in your example is that you are interpolating against the `$rootScope`, but you have declared the `template` variable on the controller's scope (which is a child of the `$rootScope`).\r\n\r\nInterpolation won't serve you well for specifying a template dynamically."}}