Created
June 24, 2018 09:18
-
-
Save firminochangani/ce6712c9278d45a8f13c3863ef808b4d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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