组织结构图未转义变量-Angular 7

时间:2019-03-17 07:27:48

标签: primeng angular7

使用PrimeNG高级组织结构图:https://www.primefaces.org/primeng/#/organizationchart

统计: 角度7 Chrome浏览器:当前版本

错误:

    compiler.js:2430 Uncaught Error: Template parse errors:
Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) ("
    </ng-template>
</p-organizationChart>
</div>[ERROR ->]"): ng:///AppModule/OrdertreeComponent.html@16:6
Unexpected closing tag "ng-template". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags ("
            <div>{{node.data.name}}</div>
        </div>
    [ERROR ->]</ng-template>
    <ng-template let-node pTemplate="department">
      { { node.label } }
"): ng:///AppModule/OrdertreeComponent.html@11:4
Invalid ICU message. Missing '}'. ("
    </ng-template>

HTML:

    <p>Organization with advanced customization.</p>
<p-organizationChart [value]="data1" selectionMode="single" [(selection)]="selectedNode" (onNodeSelect)="onNodeSelect($event)" styleClass="company">
      <ng-template let-node pTemplate="person">
     <div class="node-header ui-corner-top">{{node.label}}/div>
        <div class="node-content">
            <img src="assets/showcase/images/demo/organization/{node.data.avatar}" width="32">
            <div>{{node.data.name}}</div>
        </div>
    </ng-template>
    <ng-template let-node pTemplate="department">
      { { node.label } }
    </ng-template>
</p-organizationChart>

尝试的修复程序:

我试图对括号使用不同类型的转义方法,但实际上似乎没有任何作用。我找不到Angular 7的任何更改。

1 个答案:

答案 0 :(得分:0)

将单个大括号改为双大括号为我解决了这个问题。