简体   繁体   English

开放层/角度; 功能属性未更新

[英]Openlayers/Angular; feature properties not updating

I have a selection interaction that gets features when clicked.我有一个选择交互,单击时会获取功能。 When it's clicked I change a property to "true" in the feature.单击它时,我将功能中的属性更改为“true”。 If this property is "true" a panel in a mat-accordion is expanded.如果此属性为“真”,则展开 mat-accordion 中的面板。 The problem is that the panel is not expanded immediately, I have to turn off the layer and then turn on the layer to see the change.问题是面板没有立即展开,我必须关闭图层然后打开图层才能看到变化。 Does anyone no the problem here?有没有人在这里没有问题? Is it angular or the layer?是angular还是层?

TS (my click interaction) TS(我的点击交互)

      let feature = event.target.getFeatures().item(0);
      feature.setProperties({isFeatureSelected: true});
      console.log(feature)
      });

HTML HTML

      <mat-expansion-panel *ngIf="i < 5" [expanded]="feature.isFeatureSelected">
            <mat-expansion-panel-header collapsedHeight="38px">
              <mat-panel-title>
                {{ feature.namn }}
              </mat-panel-title>
            </mat-expansion-panel-header>
        </mat-expansion-panel>
    </div>

OpenLayers feature properties can be accessed with feature.getProperties().isFeatureSelected可以使用feature.getProperties().isFeatureSelected访问 OpenLayers 功能属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM