0

I'm getting the following error every time I ember server on my ember-cli project:

router.js: line 12, col 45, Expected an assignment or function call and instead saw an expression
router.js: line 16, col 48, Expected an assignment or function call and instead saw an expression
router.js: line 20, col 41, Expected an assignment or function call and instead saw an expression
router.js: line 23, col 25, Expected an assignment or function call and instead saw an expression

I've gone over and over my router.js file and can't seem to find the issue:

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

var Router = Ember.Router.extend({
  location: config.locationType
});

Router.map(function() {
    this.resource('dashboard',{path:'/'}),
    this.resource('items',{path:'/items'},function(){
        this.route('new'),
        this.route('edit',{path:'/:item_id'});
    }),
    this.resource('abilities',function() {
        this.route('new'),
        this.route('edit',{path:'/:ability_id'});
    }),
    this.resource('ships',function(){
       this.route('new'),
       this.route('edit',{path:'/:slug'});
    });
});

export default Router;

I thought that the dynamic segments on the routes might be the issues, but the error still came up even after changing them to resources. I did have ; at the end of each line instead of commas so I tried switching it, but that didn't fix it either. Any suggestions as to what I'm doing wrong would be appreciated. Thanks!

2
  • You do need semi-colons after your this.resource and this.route entries, not commas. This might not actually affect the program behavior, but it will make js[lh]int unhappy. What error was reported when you used semi-colons? Commented Dec 11, 2014 at 8:24
  • That was the problem. I had to use semicolons everywhere. I was using semicolons on the routes, but not on resources. Thank you! Commented Dec 11, 2014 at 8:29

1 Answer 1

1

You do need semi-colons after your this.resource and this.route entries, not commas. This might not actually affect the program behavior, but it will make js[lh]int unhappy. What error was reported when you used semi-colons?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.