問題:
I am writing an Angular application and I have an HTML response I want to display.我正在編寫一個 Angular 應用程序,我有一個要顯示的 HTML 響應。
How do I do that?我怎麼做? If I simply use the binding syntax {{myVal}}
it encodes all HTML characters (of course).如果我只是使用綁定語法{{myVal}}
它會編碼所有 HTML 字符(當然)。
I need somehow to bind the innerHTML
of a div
to the variable value.我需要以某種方式將div
的innerHTML
綁定到變量值。
解決方案:
參考一: https://stackoom.com/question/28N9j參考二: Angular HTML binding