【问题标题】:EmberJS can't find routeEmberJS 找不到路线
【发布时间】:2013-12-09 19:53:53
【问题描述】:

我是 EmberJS 的新手并遵循本教程:

http://coding.smashingmagazine.com/2013/11/07/an-in-depth-introduction-to-ember-js/

目前我有这个文件结构:

index.html
static/js/app.js
static/js/compononents
static/js/controllers/usersController.js
static/js/handlebars-v1.1.2.js
static/js/helpers
static/js/models/user.js
static/js/router.js
static/js/routes/usersRoute.js
static/js/store.js
static/js/templates/application.hbs
static/js/templates/index.hbs
static/js/templates/user.hbs
static/js/templates/users.hbs
static/js/views/

目前我已经获得了“单一用户路线”部分之前的所有代码。

我完全按照教程进行操作,但是当我转到 http://ember.lusenet.com/#/users 时,我收到错误消息“断言失败:URL '/users' 与您的应用程序中的任何路由都不匹配”。我真的不知道出了什么问题。任何帮助表示赞赏!

【问题讨论】:

  • 据我在提供的 URL 中看到的,除 app.js 之外的所有其他文件均未包含在 index.html 文件中。毫无疑问,如果不包含路线,它不会找到 #/users/。

标签: javascript jquery ember.js


【解决方案1】:

你用过https://github.com/stefanpenner/ember-app-kit 吗?你的 app.js 文件只有:

window.App = Ember.Application.create();

grunt 似乎没有正确连接您的 JS 文件。

【讨论】:

  • 我没有使用 Ember App Kit,你说得对,我没有 grunt 文件。我正在查看您发布的 Github,但我无法弄清楚哪个文件进行了连接。你有什么建议吗?
猜你喜欢
  • 2014-04-22
  • 2016-04-04
  • 2014-01-28
  • 1970-01-01
  • 2016-09-16
  • 2018-02-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多