我正在尝试自定义当我点击标记时会出现的AgmSnazzyInfoWindow。
在我的HTML文件中,我有以下代码,
<agm-snazzy-info-window [maxWidth]="800" [closeWhenOthersOpen]="true" [backgroundColor]="orange">
<ng-template>
<mat-card>{{ pLocationId }} {{ pLocationName }}</mat-card>
<mat-nav-list>
<mat-list-item>
</mat-list-item>
</mat-nav-list>
</ng-template>
</agm-snazzy-info-window>
根据属性,信息的背景颜色应为橙色,但我没有得到预期的结果。
这是我得到的信息窗口,
背景颜色不是橙色。 请纠正我在哪里出错。
答案 0 :(得分:1)
尝试编写不带括号的backgroundColor输入。如果编写它们,则angular会从控制器中查找变量/函数,而不是获取文字值。
以下代码应该起作用:
<agm-snazzy-info-window [maxWidth]="800" [closeWhenOthersOpen]="true" backgroundColor="orange">
<ng-template>
<mat-card>{{ pLocationId }} {{ pLocationName }}</mat-card>
<mat-nav-list>
<mat-list-item>
</mat-list-item>
</mat-nav-list>
</ng-template>
</agm-snazzy-info-window>