I am not able to load a webmap from Portal for ArcGis Server using ANgular TypeScript: Here is my Source Code:
esri-map.component.ts
--------------------------------------------------
import { Component, OnInit, ViewChild, ElementRef, Input, Output, EventEmitter } from '@angular/core';
import { loadModules } from 'esri-loader';
@Component({
selector: 'app-esri-map',
templateUrl: './esri-map.component.html',
styleUrls: ['./esri-map.component.css']
})
export class EsriMapComponent implements OnInit {
// this is needed to be able to create the MapView at the DOM element in this component
@ViewChild('mapViewNode') private mapViewEl: ElementRef;
constructor() { }
ngOnInit() {
loadModules([
'esri/Map',
'esri/views/MapView',
'esri/WebMap',
])
.then(([WebMap, MapView]) => {
const map = new WebMap({
basemap: 'streets',
portalItem: {
// id: 'e691172598f04ea8881cd2a4adaa45ba',
id: 'f2e9b762544945f390ca4ac3671cfa72',
}
const mapView = new MapView({
container: this.mapViewEl.nativeElement,
// center: [0.1278, 51.5074],
// zoom: 10,
map: map
});
}).catch(err => {
// handle any errors
console.error('error is:', err);
});
}
}
Can anyone help me to solve this issue?
Thanks, Waiting for your Response.