Dynamic templateUrl in directives

来源:互联网 发布:java商品交易系统 编辑:程序博客网 时间:2024/06/05 02:06

https://github.com/angular/angular.js/issues/1039


I'd like to be able to have templateUrl be configurable

eg

<my-directive templateUrl="hard-coded-path'>

Right now, this can be done via compile()

        compile:function(tElement, tAttrs, transclude) {            var html = $templateCache.get(tAttrs.templateUrl);            tElement.html(html);        },

Problem is this only works for inline template, I'd like to be able to fetch it via network if it is not available yet.

Ideally, the delayed compile function associated with templateUrl processing in Angular should be exposed to directive writers.

Very ideally, I'd like to be able to

<my-directive templateUrl="{{scope.templateUrl}}">

0 0