Angular 2模板中的渲染代码 [英] Rendering code in Angular 2 template
本文介绍了Angular 2模板中的渲染代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在使用Angular 2应用程序,需要在Angular 2模板中显示一些C#代码,稍后将使用语法突出显示工具对其进行样式设置.
I'm currently working on an Angular 2 application and need to display some C# code in an Angular 2 template which will later be styled using a syntax highlighter.
但是,一旦我将代码放到Angular 2模板中,我就会收到模板解析错误,因为它试图解析C#并失败.
However, as soon as I drop the code into an Angular 2 template I get template parse errors as it tries to parse the C# and fail.
zone.js:355未处理的承诺拒绝:模板解析错误:< code> ...
对此有什么解决方案?Angular 2是否可以忽略模板的代码部分?
What is the solution to this? Does Angular 2 include ability to ignore the code portions of my template?
推荐答案
<code ngNonBindable>
code here
</code>
这篇关于Angular 2模板中的渲染代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文