[Vuejs]-Trying to show other side of one-to-one relationship in Vue

0👍

From your screenshot it looks like you have an array of objects being returned. You would not be able to get .name because it is an array not an object being returned. If you want just the country name you might need to display it as:

{{ border[0].name }}

0👍

I found a solution:

function search(nameKey, myArray) {
    for (var i = 0; i < myArray.length; i++) {
      if (myArray[i].alpha3Code === nameKey) {
        return myArray[i];
      }
    }
  }

This worked perfectly after putting countryLookup(border).name I don’t think I was searching the array properly

Leave a comment