How to create a directive with a dynamic template in AngularJS?

后端 未结 7 855
傲寒
傲寒 2020-12-02 14:45

How can I create a directive with a dynamic template?

\'use strict\';

app.directive(\'ngFormField\', function($compil         


        
7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 15:04

    One way is using a template function in your directive:

    ...
    template: function(tElem, tAttrs){
        return '
    '; } ...

提交回复
热议问题