ubaldop / vue-country-flag

Vue component for country flags

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I have country name from an API, how can I bind it to country attribute?

yiyasha15 opened this issue · comments

I have country name from an API, how can I bind it to country attribute?

I created a data method which returns value of the country,

data() {
      return {
        flag: this.artist.country
      }
    }

In my template I have
<country-flag country= flag />

But the flag image is not showing.

Hi @yiyasha15,

I'd expect you pass the reactive attribute like this:

<country-flag :country="country.flag"/>

where country.flag is the dynamic value received from an API. You can see an example in action here.
This renders the following output.

Let me know if this solves your issue 😺

Hi @p3trur0 ,
Thanks alot it worked! 😺