Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vue js 2 way data binding not updating

Tags:

vue.js

so i have a quick Vue JS question that seems very strange, i have the following

var home = new Vue({
 el: '#home',
 data:{
    title: 'welcome to the app'
 }
});

Which works fine, and title in my HTML gets updated fine...

now when i do this

home.$data.title = 'this is the new title'

the html

  <div class="app-topbar">{{title | uppercase}}</div>

Does not update, do i have to force an update to the data binding or something?

Thanks Sam

like image 861
user1997198 Avatar asked Jul 12 '15 19:07

user1997198


1 Answers

This works fine for me. Just set home.title, like this: http://jsfiddle.net/6x2v9y20/1/

Maybe you're trying to access home.title before the Vue item has been created?

like image 167
swift Avatar answered Sep 30 '22 05:09

swift