1

我有以下图表:

<ngx-graph
style="max-height: 60vh; display:block;"
[links]="links"
[nodes]="nodes"
[autoCenter]="autoCenter"
[update$]="update$"
[center$]="center$"
[zoomToFit$]="zoomToFit$"
[enableZoom]="zoomEnabled"
[draggingEnabled]="draggingEnabled">
    <ng-template #defsTemplate>
        <svg:marker id="arrow" viewBox="0 -5 10 10" refX="8" refY="0" markerWidth="4" markerHeight="4" orient="auto">
            <svg:path d="M0,-5L10,0L0,5" class="arrow-head" />
        </svg:marker>
    </ng-template>
    <ng-template #nodeTemplate let-node>
        <svg:g class="node" (click)="goToContact(node.id)" style="cursor:pointer">
            <svg:rect [attr.width]="node.dimension.width" [attr.height]="node.dimension.height" [attr.fill]="node.data.color"/>
            <svg:text alignment-baseline="central" [attr.x]="10" [attr.y]="node.dimension.height / 2">{{node.label}}</svg:text>
        </svg:g>
    </ng-template>
    <ng-template #linkTemplate let-link>
        <svg:g class="edge">
            <svg:path class="line" stroke-width="2" marker-end="url(#arrow)"></svg:path>
            <svg:text class="edge-label" text-anchor="middle">
                <textPath class="text-path" [attr.href]="'#' + link.id" [style.dominant-baseline]="link.dominantBaseline" startOffset="50%">
                    {{link.label}}
                </textPath>
            </svg:text>
        </svg:g>
    </ng-template>
</ngx-graph>

现在它只是填充:

    if (this.contactLastname == null && this.contactFirstname == null)
        label = this.contactCompany
    else
        label = this.contactLastname + ' ' + this.contactFirstname

    this.nodes.push({
        id: this.contactId.toString(),
        label: label
    })

如果我使用以下命令运行它,我没有任何问题,我的节点将毫无问题地显示:

ng build --watch

如果我运行其中一个命令,则会出现错误:

ng build --watch --aot=true
ng build --prod && npm run build-css

错误 :

ERROR NullInjectorError: StaticInjectorError(AppModule)[TooltipService -> InjectionService]: 
  StaticInjectorError(Platform: core)[TooltipService -> InjectionService]: 
    NullInjectorError: No provider for InjectionService!

提前致谢

4

0 回答 0