frankcollins3 / ASPokedex

Pokedex with ASP backend / razor pages, and VanillaJS front end
1 stars 0 forks source link

dynamically interpolate id into string for @Model [10:59pm] #7

Open frankcollins3 opened 1 year ago

frankcollins3 commented 1 year ago

attempting to do: 1st page: consumes pokeapi.co API which returns all pokemon as { name: pokemon.name, url: pokemon.url } push data to array loop over that array and do an API call for every pokemon name: pokeapi.co/pokemon/${name}. this allows rendering of img src.

when a user/human hovers onto the img-data, the original app makes another data call and uses id from event.target params. This time in ASP.net, the img src for back_default is prepared in the code-behind.

mouse enter uses [i] and event.target id params to retrieve corresponding image.

error: minimum viable test of a hard-coded id into the @Model.PokemonSrcback works. attempting to do so dynamically is returning issues with the string. Screen Shot 2023-09-18 at 10 53 31 PM

proposed approach: 0: already test with hardcoded string. 1: make a new string without hardcoding it.

possible improvements: