如何在ngFor中传递两个单独的变量?

时间:2018-10-24 08:34:01

标签: angular openlayers ngfor

我正在尝试以角度使用openlayers。问题是我无法传递变量的ID,因为它在ngFor变量之外。我怎样才能做到这一点?

this.configService.getConfig2().subscribe((e: LineVariantTrack) =>{
                  this.line = e;
{
  "baseVersion": "string",
  "netVersion": 0,
  "mandator": "string",
  "lineNumber": 0,
  "lineVariantNumber": 0,
  "segments": [
    {
      "position": 0,
      "length": 0,
      "from": {
        "shortName": "string",
        "name": "string",
        "position": {
          "longitude": 0,
          "latitude": 0
        }
      },
      "to": {
        "shortName": "string",
        "name": "string",
        "position": {
          "longitude": 0,
          "latitude": 0
        }
      },
<aol-feature *ngFor="let s of  line?.segments " [id]="line?.lineNumber"> //want to pass id here
        <aol-geometry-linestring >
         <aol-collection-coordinates
         [coordinates]="[[s?.from?.position?.longitude || s?.to?.position?.longitude, s?.from?.position?.latitude || s?.to?.position?.latitude],[s?.to?.position?.longitude || s?.from?.position?.longitude, s?.to?.position?.latitude || s?.from?.position?.latitude]]"
              [srid]="'EPSG:4326'">
          </aol-collection-coordinates>
      </aol-geometry-linestring>

0 个答案:

没有答案