mercredi 29 mars 2017

Ember syntax errors

I am learning ember.js with a tutorial that is built in to their documentation. Having installed it successfully, I followed the steps and created a new application with ember new ember-quickstart, generated a template and defined a route. However, the data that I've included in the route model is not being rendered (there appears to be a parsing error due to an unexpected token default), but I have no idea what it might be referring to. I have pasted the code exactly as it appears. Any suggestions as to what might be causing the error?

SyntaxError: ember-quickstart/routes/scientists.js: Unexpected token (3:2)  

enter image description here

routes/scientists.js

import Ember from 'ember';

  default Ember.Route.extend({
  model(){
    return['Marie Curie', 'Albert Einstein', 'Andrei Sakharov']
  }
});

templates/scientists.hbs

<h2>List of Scientists</h2>

<ul>
  
  <li></li>
  
</ul>

templates/application.hbs

<h2 id="title">Welcome To Ember</h2>



app/router.js

import Ember from 'ember';
import config from './config/environment';

const Router = Ember.Router.extend({
  location: config.locationType,
  rootURL: config.rootURL
});

Router.map(function() {
  this.route('scientists');
});

export default Router;




Aucun commentaire:

Enregistrer un commentaire