0👍
You are printing result.title
and result.description
as string literals, you need to put them in mustaches to print them from data:
<div id = "news-container" v-for="result in res">
<h1> {{result.title}} </h1>
<p> {{result.description}} </p>
</div>
- [Vuejs]-Vue way of writing HTML as a string variable / string template
- [Vuejs]-Zoom issue in dagre-d3 when use with vuejs2 with watch mode
0👍
I think your problem is in position html elements. Try this way and I think it should work.
<body>
<div id="app">
<h1> News Aggregator </h1>
<div id="selector">
<select v-model="selected">
<option v-for="select in selection" :value="select">{{select}}</option>
</select>
<button @click="getNews(selected)"> Get news </button>
</div>
<div id="news-container" v-for="result in res">
<h1> {{result.title}} </h1>
<p> {{result.description}} </p>
</div>
</div>
</body>
- [Vuejs]-How to fix 'didn't work redirect by Turbolinks' in Ruby on Rails with Vue.js
- [Vuejs]-Vue.js + Avoriaz : how to test a watcher?
Source:stackexchange.com