Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Typescript language in Visual Studio how can I change static code to a non-static code? Below is a portion of my code since I'm

Using Typescript language in Visual Studio how can I change static code to a non-static code? Below is a portion of my code since I'm unable to post the rest. In my scenario, I'm working on trying to get a 'sickness-data.geojson' file that contains these fake zipcodes and a few data. Note: The bolded titles are names of my files that associate with this portion of the code: --------------------------------------- map-sidebar-mode.enum.ts export enum MapSidebarMode { SINGLE_TRACT_BREAKDOWN = 'single-tract-breakdown', SINGLE_ZIPCODE_BREAKDOWN = 'single-zipcode-breakdown', MULTI_TRACT_BREAKDOWN = 'multi-tract-breakdown', MULTI_ZIPCODE_BREAKDOWN = 'multi-zipcode-breakdown', FEATURE_POINT_SUMMARY = 'feature-point-summary'

----------------------------------------

sickness-data.geojson

{ "type": "FeatureCollection", "name": "SicknessData", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::4269" } }, "features": [ { "type": "Feature", "properties": { "Sickness Vaccination, Number of Children < 18yrs with at least one dose, as of 9\/17\/2018": "1234", "Sickness Vaccination, Percent of Children < 18yrs with at least one dose (%), as of 9\/17\/2018": "12.3", "Latitude": 12.345678, "Longitude": -12.345678, "Zip": "12345 }, "geometry": { "type": "Point", "coordinates": [ -12.345678, 12.345678 ] } },

{ "type": "Feature", "properties": { "Sickness Vaccination, Number of Children < 18yrs with at least one dose, as of 9\/17\/2018": "4321", "Sickness Vaccination, Percent of Children < 18yrs with at least one dose (%), as of 9\/17\/2018": "43.2", "Latitude": 87.654321, "Longitude": -87.654321, "Zip": "54321 }, "geometry": { "type": "Point", "coordinates": [ -87.654321, 87.654321 ] } },

---------------------------------------- ***(THIS IS THE PORTION I NEED TO CHANGE TO NONSTATIC)***

map-sidebar.components.ts

...

string1: string | undefined;

get38002CC(data: MapSidebarData): string | undefined{ if(data.layerFeatureData!.id == '12345'){ return '2787'; } else if (data.layerFeatureData!.id == '87654'){ return '1184'; }

else{ return this.string1; } }

get38002CCP(data: MapSidebarData): string | undefined{ if(data.layerFeatureData!.id == '12345'){ return '12.3%'; } else if (data.layerFeatureData!.id == '87654'){ return '3.21%'; }

else{ return this.string1; } }

...

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started