admin管理员组

文章数量:1122846

Ref: /

I am trying to implement Arcgis with angular, everything is working fine map is displaying and layers are working until Item-Id is hardcoded (<arcgis-map item-id="sdfdfd43443433"...), but I want to assign "item-id" property dynamically, but it is not working correctly, not sure what am I missing here, here is the sample code

<arcgis-map [item-id]="itemId"></arcgis-map>
      OR
<arcgis-map item-id="{{itemId}}"></arcgis-map>

  @Component({
      selector: 'app-my-map',
      templateUrl: './my-mapponent.html',
      styleUrls: ['./my-mapponent.css']
    })
    export class MyMapComponent implements OnInit {
      itemId = 'YOUR_ITEM_ID'; // Replace with your actual item ID
    
      ngOnInit() {
      }
    }

Ref: https://developers.arcgis.com/javascript/latest/get-started-angular/

I am trying to implement Arcgis with angular, everything is working fine map is displaying and layers are working until Item-Id is hardcoded (<arcgis-map item-id="sdfdfd43443433"...), but I want to assign "item-id" property dynamically, but it is not working correctly, not sure what am I missing here, here is the sample code

<arcgis-map [item-id]="itemId"></arcgis-map>
      OR
<arcgis-map item-id="{{itemId}}"></arcgis-map>

  @Component({
      selector: 'app-my-map',
      templateUrl: './my-map.component.html',
      styleUrls: ['./my-map.component.css']
    })
    export class MyMapComponent implements OnInit {
      itemId = 'YOUR_ITEM_ID'; // Replace with your actual item ID
    
      ngOnInit() {
      }
    }
Share Improve this question edited Nov 23, 2024 at 16:09 Naren Murali 54.6k5 gold badges40 silver badges70 bronze badges asked Nov 23, 2024 at 0:09 HariHari 393 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

You can use the [attr.<<attribute name>>]="<<value>>" syntax to dynamically bind the attribute value.

<arcgis-map [attr.item-id]="itemId"></arcgis-map>

本文标签: htmlAngular 17 with ArcGIS ItemidStack Overflow