Execute a function after subscribe in angular 10

39 views Asked by At

I have a subscribe function in angular 10. I am getting the console 'geom' before executing the subscribe. Please describe how to execute the next section ie, calling to zoomToGeometry() only after executing the subscribe?

hitself.gisService.getidDetails(hitself.id).subscribe((posts) => {
            console.warn(`gisService executed - ${hitself.id}`);

            const get_wkid = posts[0]['spatialReference'];
            hitself.wkid = get_wkid['wkid'];
            const dynamicrings = posts[0]['features'];
            hitself.dynamicRings = dynamicrings[0]['geometry']['rings'];
            const geom = new hitself.esriModules.geometry.Polygon({
              spatialReference: {
                wkid: hitself.wkid,
              },
              rings: hitself.dynamicRings,
            });
            console.warn(`geom ${hitself.dynamicRings}`);

            hitself.zoomToGeometry(geom);
          });
0

There are 0 answers