Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否曾经担心 AngularDart 中的字符转义?我认为小胡子渲染总是安全的;例如
<span>{{ctrl.recipe.name}}</span>
有人可以确认吗?新手还需要注意什么其他情况?
AngularDart 中的所有内容都被转义。{{expression}}导致使用非innerHTMLAPI 编写的字符串,因此浏览器会对其进行转义。
{{expression}}
innerHTML
你说的对。如果ctrl.recipe.name包含“危险”内容,它将被剥离。您需要一个 NodeValidator 来指定允许哪些 HTML 元素/属性。
ctrl.recipe.name
也可以看看: