Vue
by Edward Tanguay
HTML
<div id="app">
<div class="information">{{message}}</div>
<button @click="changeTheText">Change the Text</button>
</div>
CSS
body {
padding: 130px;
}
.information {
color: orange;
}
Vue
const app = new Vue({
el: "#app",
data: {
message: ''
},
methods: {
initialize: function(){
this.message = 'test';
},
changeTheText: function() {
const that = this;
this.getEmployerNameWithId(34, function(employee) {
that.message = employee.name;
});
},
getEmployerNameWithId: function(id, callback) {
this.lookupName(id, function(person) {
const employee = {
name: person.firstName + ' ' + person.lastName,
age: 34
};
callback(employee);
}
}
}
});
app.initialize();