Angular HTML binding

后端 未结 21 2745
暖寄归人
暖寄归人 2020-11-21 04:00

I am writing an Angular application and I have an HTML response I want to display.

How do I do that? If I simply use the binding syntax {{myVal}} it en

21条回答
  •  猫巷女王i
    2020-11-21 05:03

    You can use several approaches to achieve the solution. As already said in the approved answer, you can use:

    depending on what you are trying to achieve, you can also try other things like javascript DOM (not recommended, DOM operations are slow):

    Presentation

    Component

    var p = document.getElementsById("test");
    p.outerHTML = myVal;
    

    Property Binding

    Javascript DOM Outer HTML

提交回复
热议问题