B
B
Bogdan2018-02-09 10:33:12
Vue.js
Bogdan, 2018-02-09 10:33:12

Pass variable as parameter to template?

Hello! How to correctly pass a variable to template?

const db =[{one: 1 }];

new Vue({
  el: '#app',
  template: '<Peoples :db={{ db }}/>',
  components: { Peoples }
})

Gives an error message

- invalid expression: expected property name, got '{' in
{{
Raw expression: :db="{{"

Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima Polos, 2018-02-09
@bogdan_uman

Make it computed, which will take the variable from outside and make it a field of the vue instance.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question