我想在我的应用程序组件中使用google漂亮打印来显示源代码。我在'pre'标记中使用ngNonBindable。但它在编译/页面运行时会出错。ngNonBindable不能在angular-2中工作
zone.js:388Unhandled Promise rejection: Template parse errors:
Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) ("
<div id="routerContainer">
<router-outlet></router-outlet>
</div>[ERROR ->]"): [email protected]:6
Invalid ICU message. Missing '}'. ("
<div id="routerContainer">
<router-outlet></router-outlet>
</div>[ERROR ->]"): [email protected]:6 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors:(…) Error: Template parse errors:
Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) ("
我的HTML代码
<pre class="prettyprint" ngNonBindable>
import {Component} from '@angular/core';
</pre>
你为什么在'pre'标签中使用import语句? 'ngNonBindable'告诉angular2不要评估任何表达式或绑定。 – micronyks
@micrnyks,我在我的网页中显示整个.ts源代码。它仅用于显示目的而不是用于解析目的。它是一个angular2错误,它解析{}尽管ngNonBindable。 – raju