ember-cli / pod:嵌套resources/templates
ember-cli / pod: Nesting resources/templates
我已经阅读了各种 Whosebug 线程和其他论坛条目,但我无法弄清楚如何使用 ember-cli 0.1.12 嵌套 resources/templates 工作 和 pod 结构。
版本:
- Ember:1.8.1(也试过 1.9.1)
- Ember 数据:1.0.0-beta.12
- 车把:1.3.0(也试过 2.0.0)
- jQuery : 1.11.2
我的router.js(未更改,cli 创建它,仅用于演示目的):
Router.map(function() {
this.resource("controls", function() {
this.route("statements");
this.resource("handles", function() {});
});
情况:
- 除了 ember 之外没有其他修改在创建的 template.hbs
中生成命令和文本标记
- 资源"controls":模板按预期显示
- 路由"controls/statements": 模板按预期显示
- 资源 "controls" 下的资源 "handles" 根本没有呈现。
- "controls/handles" 下的后续路由也无法正常工作。
- 当我调用 http://localhost:4200/controls/handles 时,ember 检查器仅在视图树中列出 "application" 和 "controls"。在 ember inspector routes 部分,它列出了:handles.index
HandlesIndexRoute 发送到控制台
HandlesIndexController 发送到控制台
handles/index
/controls/handles
我试过了:
- 切换 ember 和车把版本 - 无效
- 未使用 pod 结构 - 无效
- 在 handles pod 文件夹中手动添加 index.hbs 模板 - 无效
我觉得我在这里缺少一个基本点。
你能帮帮我吗?
谢谢,
曼纽尔
我无法解决 pod 问题,但可以尝试其他问题。
您的嵌套资源的性质是什么?
我希望这样的 URL:“..controls/:control_id/handles”。
我会这样写:
this.resource('controls', function() {
this.route('statements');
this.route('show', { path: ':control_id' }, function() {
this.resource('handles', function() {
});
});
});
尼克
我已经阅读了各种 Whosebug 线程和其他论坛条目,但我无法弄清楚如何使用 ember-cli 0.1.12 嵌套 resources/templates 工作 和 pod 结构。
版本:
- Ember:1.8.1(也试过 1.9.1)
- Ember 数据:1.0.0-beta.12
- 车把:1.3.0(也试过 2.0.0)
- jQuery : 1.11.2
我的router.js(未更改,cli 创建它,仅用于演示目的):
Router.map(function() {
this.resource("controls", function() {
this.route("statements");
this.resource("handles", function() {});
});
情况:
- 除了 ember 之外没有其他修改在创建的 template.hbs 中生成命令和文本标记
- 资源"controls":模板按预期显示
- 路由"controls/statements": 模板按预期显示
- 资源 "controls" 下的资源 "handles" 根本没有呈现。
- "controls/handles" 下的后续路由也无法正常工作。
- 当我调用 http://localhost:4200/controls/handles 时,ember 检查器仅在视图树中列出 "application" 和 "controls"。在 ember inspector routes 部分,它列出了:handles.index HandlesIndexRoute 发送到控制台 HandlesIndexController 发送到控制台 handles/index /controls/handles
我试过了:
- 切换 ember 和车把版本 - 无效
- 未使用 pod 结构 - 无效
- 在 handles pod 文件夹中手动添加 index.hbs 模板 - 无效
我觉得我在这里缺少一个基本点。 你能帮帮我吗?
谢谢, 曼纽尔
我无法解决 pod 问题,但可以尝试其他问题。 您的嵌套资源的性质是什么?
我希望这样的 URL:“..controls/:control_id/handles”。
我会这样写:
this.resource('controls', function() {
this.route('statements');
this.route('show', { path: ':control_id' }, function() {
this.resource('handles', function() {
});
});
});
尼克