Skip to content

Instantly share code, notes, and snippets.

@firminochangani
Created June 24, 2018 09:18
Show Gist options
  • Save firminochangani/ce6712c9278d45a8f13c3863ef808b4d to your computer and use it in GitHub Desktop.
Save firminochangani/ce6712c9278d45a8f13c3863ef808b4d to your computer and use it in GitHub Desktop.
created() {
// Making the http request with Fetch API
const API = 'https://restcountries.eu/rest/v2/all';
fetch(API, {method: 'GET'})
.then(res => res.json())
.then((json) => {
// Place results into the state property
this.countries = json;
})
.catch(err => console.log(err));
},
<ul>
<li v-for="country in countries" :key="country.id">
{{ country.name }}
</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment