I have a 'watch' template that should show info about a game and the teams. I also wanted to display the currently logged in user's details on the page.
However when I add ('user', params.id) I get the error params is not defined ReferenceError:
routes/watch.js
App.WatchRoute = Ember.Route.extend({
model: function() {
return Ember.RSVP.hash({
game: this.store.find('game'),
team: this.store.find('team'),
user: this.store.find('user', params.id)
})
}
});
models/user.js
App.User = DS.Model.extend({
uid: DS.attr('string'),
firstName: DS.attr('string'),
lastName: DS.attr('string'),
email: DS.attr('string'),
profileImage: DS.attr('string'),
timestamp: DS.attr('number')
});
models/game.js
App.Game = DS.Model.extend({
gameName: DS.attr('string'),
teams: DS.hasMany('team'),
timestamp: DS.attr('number')
});
models/team.js
App.Team = DS.Model.extend({
teamName: DS.attr('string'),
game: DS.belongsTO('game'),
timestamp: DS.attr('number')
})
router.js
App.Router.map(function() {
this.resource('login');
this.resource('logout');
this.resource('signup', {path: '/'});
this.resource('home', { path: '/:id' });
this.resource('watch', { path: '/watch/:id' });
this.resource('games');
this.resource('game', {path: 'teams/:id'});
this.resource('teams');
this.resource('team', {path: 'teams/:id'});
});
Thanks in advanced for any help in this.
Aucun commentaire:
Enregistrer un commentaire