简体   繁体   中英

Stopping AngularJS from not executing HTML tags

So I am wondering how to compute HTML in an AngularJS object (Like this: {{names}} ) but I have an '<a>' element inside the object.

It comes out like this:

<a href="http://www.example.com">link text</a>

I want this: link text
I want the links in this page to be the ones.

我很确定你正在寻找的答案可以在这里找到ng-href将允许你使用{{}}语法动态生成角度控制器的URL。

I think you need something like this <div ng-bind-html="name"></div> .

Note: you may need to do an '$sce.trustAsHtml()' if your HTML contents contain links. But be sure that what content goes in the HTML is safe before doing this. See more details Here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM