[Vuejs]-Vue.js: Element is not defined?

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>

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>

Leave a comment