Change a Tag Dynamically? Angular 2

前端 未结 4 499
-上瘾入骨i
-上瘾入骨i 2020-12-16 23:28

Is there anyway to change this:

Some text here

To:

Some text here
4条回答
  •  别那么骄傲
    2020-12-17 00:06

    Here is another way to avoid duplication. I needed to use a different tag depending on some condition:

    Create template which both tags will use:

    
          

    Hello and Hi

    Bye

    Define both tags and use ngIf. The content of the tags will be the template created above.

提交回复
热议问题