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

后端 未结 7 870
傲寒
傲寒 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:14

    If you want to use AngularJs Directive with dynamic template, you can use those answers,But here is more professional and legal syntax of it.You can use templateUrl not only with single value.You can use it as a function,which returns a value as url.That function has some arguments,which you can use.

    http://www.w3docs.com/snippets/angularjs/dynamically-change-template-url-in-angularjs-directives.html

提交回复
热议问题