Hi John - it works ok with pure Javascript. I'm using typescript and angular so I guess this is whats giving me trouble. My code is below. I've based it on the github jsapi-angular-cli example located here: https://github.com/Esri/jsapi-resources
initializeMap(): Promise<any> {
const map = new Map({
basemap: 'streets'
});
const view = new MapView({
container: this.viewNode.nativeElement,
center: [-117.5, 33.9],
zoom: 10,
map: map
});
const graphicsLayer = new GraphicsLayer();
map.add(graphicsLayer);
//when ticket clicked in ticketlist component--polygon graphic of ticket extent returned here
this.TicketGraphicSubscription =
this.mapService.TicketGraphicRequest.subscribe((polygonGraphic: Graphic) => {
let ptGraphic = new Graphic();
ptGraphic = this.mapService.MakeTicketLabelPoint(polygonGraphic.attributes.Ticket,
polygonGraphic.geometry.extent.center);
graphicsLayer.addMany([polygonGraphic, ptGraphic]);
view.center = polygonGraphic.geometry.extent.center;
view.zoom = 16;
console.log("view zoomed");
//map has to be panned or zoomed to see label
});
this.view = view;
return this.view.when();
}
I also tried taking away the calls to the map service and doing everything within this function but got same results.