Ember cli,无法显示/调试我的模型数据

时间:2015-02-24 13:41:45

标签: ember-cli jsbin

我正在使用JSBIN测试一些Ember的东西,我似乎无法显示我的模型数据。

不幸的是,只有错误,我得到的是“脚本错误(第0行)”,这不是很有帮助。

JSBIn在这里: http://jsbin.com/duqehebewu/3/edit?html,console,output

<script src="http://static.iamstef.net/ember-cli-jsbin/jquery/dist/jquery.js"></script>
<script src="http://static.iamstef.net/ember-cli-jsbin/loader.js/loader.js"></script>
<script src="http://static.iamstef.net/ember-cli-jsbin/handlebars/handlebars.js"></script>
<script src="http://static.iamstef.net/ember-cli-jsbin/ember/ember.js"></script>
<script src="http://static.iamstef.net/ember-cli-jsbin/ember-load-initializers/ember-load-initializers.js"></script>
<script src="http://static.iamstef.net/ember-cli-jsbin/ember-resolver/dist/ember-resolver.js"></script>
<script src="http://static.iamstef.net/ember-cli-jsbin/ember-cli-shims/app-shims.js"></script>
<script src="http://static.iamstef.net/ember-cli-jsbin/ember-cli.js"></script>
<meta name="ember-app" content="app" mode="auto-run">
<script type='text/x-esnext' id='app/app'>
import Ember from 'ember';
import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';

Ember.MODEL_FACTORY_INJECTIONS = true;

var App = Ember.Application.extend({
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix,
  Resolver: Resolver
});

loadInitializers(App, config.modulePrefix);

export default App;
</script>

<script type='text/x-esnext' id='app/config/environment'>
export default { modulePrefix: 'app', locationType: 'hash'};
</script>

<script type='text/x-esnext' id='app/router'>
import Ember from 'ember';
import config from './config/environment';

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


export default Router;
</script>

<script type='text/x-esnext' id='app/router/index'>
import Ember from 'ember';
import config from './config/environment';

var posts = [{
  title: "Rails is omakase",
  body: "There are lots of à la carte software environments in this world."
}, {
  title: "Broken Promises",
  body: "James Coglan wrote a lengthy article about Promises in node.js."
}];

var IndexRouter = Ember.Router.extend({
  location: config.locationType,
  model: function() {
     return posts;
 }
});

export default IndexRouter;
</script>


<script type='text/x-handlebars' id='app/templates/application'>
<h2 id='title'>Welcome to Ember.js</h2>

{{outlet}}
</script>



<script type='text/x-handlebars' id='app/templates/index'>
<h1>Index template</h1>
{{#each}}
      {{body}}
{{/each}}
</script>

1 个答案:

答案 0 :(得分:1)

我不确定如何在JSBin中使用Ember cli。这是一个非cli版本:

http://jsbin.com/zixaju/2/edit

编辑:知道了。

http://jsbin.com/qimeta/2/edit

Edit2:真实:

http://jsbin.com/qimeta/4/edit