Ember语法错误

时间:2017-03-29 09:30:42

标签: ember.js

我正在学习使用内置于documentation的教程的ember.js。成功安装后,我按照步骤创建了一个带有ember new ember-quickstart的新应用程序,生成了一个模板并定义了一个路径。但是,我没有呈现我在路由模型中包含的数据(由于意外的令牌默认值,似乎存在解析错误),但我不知道它可能指的是什么。我已经准确地粘贴了代码。有关可能导致错误的原因的任何建议?

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

enter image description here

路由/ scientists.js

import Ember from 'ember';

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

模板/ scientists.hbs

<h2>List of Scientists</h2>

<ul>
  {{#each model as |scientist|}}
  <li>{{scientist}}</li>
  {{/each}}
</ul>

templates / application.hbs

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

{{outlet}}

应用程序/ 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;

1 个答案:

答案 0 :(得分:1)

    DECLARE @Table TABLE
    (EmployeeID INT,OrganisationID INT,Level INT,Manager1 INT,Manager2 INT,Manager3 INT,Manager4 INT,Manager5 INT)

    INSERT INTO @Table VALUES
    (1,1001,1,NULL,NULL,NULL,NULL,NULL),    
    (8,1011,1,1   ,NULL,NULL,NULL,NULL),    
    (2,1002,2,1   ,1   ,NULL,NULL,NULL),    
    (3,1002,2,1   ,1   ,NULL,NULL,NULL),    
    (4,1003,4,1   ,2   ,NULL,4   ,NULL),    
    (5,1004,3,NULL,NULL,2   ,NULL,NULL),    
    (6,1005,5,1   ,NULL,2   ,6   ,6   ),
    (7,1006,5,NULL,7   ,7   ,NULL,NULL)


    SELECT EmployeeID, 
    CASE
        WHEN level = 1 THEN  NULLIF(Manager1,EmployeeID)
        WHEN level = 2 THEN  COALESCE(NULLIF(Manager2,EmployeeID),NULLIF(Manager1,EmployeeID))
        WHEN level = 3 THEN  COALESCE(NULLIF(Manager3,EmployeeID),NULLIF(Manager2,EmployeeID),NULLIF(Manager1,EmployeeID))
        WHEN level = 4 THEN  COALESCE(NULLIF(Manager4,EmployeeID),NULLIF(Manager3,EmployeeID),NULLIF(Manager2,EmployeeID),NULLIF(Manager1,EmployeeID))
        WHEN level = 5 THEN  COALESCE(NULLIF(Manager5,EmployeeID),NULLIF(Manager4,EmployeeID),NULLIF(Manager3,EmployeeID),NULLIF(Manager2,EmployeeID),NULLIF(Manager1,EmployeeID))
        END AS Manager
    FROM @Table

应该是:

default Ember.Route.extend({