I'm trying to get to grips with Ember 2.3.0 but I'm having trouble with the following piece of code:
route.js:
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
login: function() {
this.store.query('user', {
name: this.controller.get('name')
}).then((users) => {
if(users.get('length') === 1 {
var user = users.objectAt(0);
this.controllerFor('application').set('user', user);
this.transitionTo('notebooks');
} else {
console.log('unexpected query result');
}
});
}
}
});
I get the following build error:
File: ember-note/login/route.js
ember-note/login/route.js: Unexpected token (9:33)
SyntaxError: ember-note/login/route.js: Unexpected token (9:33)
7 | name: this.controller.get('name')
8 | }).then((users) => {
> 9 | if(users.get('length') === 1 {
| ^
I'm sure an Ember pro will get this straight away. Cheers
Aucun commentaire:
Enregistrer un commentaire