cherifGsoul on update-api-page
cherifGsoul on master
Update API page (#5432) * Upda… (compare)
greenkeeper[bot] on core-js-3.5.0
chore(package): update core-js … (compare)
greenkeeper[bot] on can-observable-mixin-1.0.7
fix(package): update can-observ… (compare)
cherifGsoul on update-infrastructure-page
cherifGsoul on master
Update infrastructure page with… (compare)
cherifGsoul on update-infrastructure-page
Fix typos (compare)
Component.extend({
tag: 'pgat-player-bio',
template,
viewModel: PlayerBioViewModel,
events: {
inserted: function () {
Players.get({ id: 'id' }).then($.proxy((data)=>{
this.onPlayersData(data);
}, this));
console.log(this.viewModel.personalStats.scoringAverage;
},
onPlayersData: function (playerList) {
this.players = {};
playerList.players.forEach((player)=>{
this.players[player.playerId] = player;
});
this.viewModel.attr('playerList', playerList);
}
}
});
var PlayerBioViewModel = DefineMap.extend({
name: 'Select Player',
personalInfo: {
Value: PlayerBio
},
personalResults: {
Value: PlayerResults
},
personalStats: {
Value: PlayerStats
},
personalStat186: {
Value: PlayerStat186
},
playerList: {
players: []
},
showMetric: false
});
Value: something
syntax is correct
here is the excerpt from the docs
Value {function}: Specifies a function that will be called with new whose result is set as the initial value of the attribute.
// A default empty DefineList of hobbies:
var Person = DefineMap.extend({
hobbies: {Value: DefineList}
});
new Person().hobbies //-> []
let LoginViewModel = DefineMap.extend({
user: {
value: Object,
Type: User
}
});
Component.extend({
tag: "login-form",
template: Login,
ViewModel: LoginViewModel
});
here's an example of some code that works and properly populates the field on the view model