angular load template from url and compile inside div

前端 未结 3 1941
野性不改
野性不改 2021-02-02 13:46

As I\'m new to Angular JS I was wondering how could I load an external template and compile it with some data into the targeted div.

For instance I have thi

3条回答
  •  别那么骄傲
    2021-02-02 14:19

    in Angular there's 2 ways of using template (at least 2 ways that i know about):

    • the first using an inline template (in the same file) with this syntax:

      
      
    • the second one (what you want) is external template:

      
      

    so what you need to do is to remove the script part from your template and then use the ng-include in the wanted div like this:

    need to have double quotes and single quotes to work. Hope this helps.

提交回复
热议问题