Ember.js路由:url中的动态段错误
Ember.js Routes: Dynamic segments in url error
我的路由器看起来像:
App.Router.map(function () {
this.route('index', {path: '/'})
this.resource('products', function () {
this.route('all', {path: '/'});
this.resource('products.edit', {path: '/edit/:id'}, function () {
this.route('general');
this.route('images');
this.route('reviews');
});
});
this.resource('category', function () {
this.route('all', {path: '/'});
this.resource('category.edit', {path: '/edit/:category_id'}, function () {
this.route('general');
this.route('images');
this.route('products_of_category');
});
});
});
在导航菜单中,我有"添加/编辑Product
"answers"添加/修改Category
",它们链接到products.edit
和category.edit
路线。但当我渲染页面时,我得到一个错误,说:
TypeError: newHandlerInfo is undefined
当我去除嵌段:product_id
和:category_id
时,它工作得很好。
以下是我的型号:
App.Product = Ember.Object.extend({
id: null,
productName: null,
dateAdded: null,
description: null,
price: null,
status: null,
categories: [],
categoryNames: []
});
App.Category = Ember.Object.extend({
id: null,
categoryName: null,
dateAdded: null,
description: null,
children: [],
parent: null,
products: []
});
可能是您想要的路由器:
App.Router.map(function() {
this.route('index', {path: '/'});
this.resource('products', function() {
this.route('all', {path: '/'});
this.route('edit_general', {path: '/edit/:product_id/general'});
this.route('edit_images', {path: '/edit/:product_id/images'});
this.route('edit_reviews', {path: '/edit/:product_id/reviews'});
});
this.resource('category', function() {
this.route('all', {path: '/'});
this.route('edit_general', {path: '/edit/:category_id/general'});
this.route('edit_images', {path: '/edit/:category_id/images'});
this.route('edit_products', {path: '/edit/:category_id/products'});
});
});
相关文章:
- Meteor.js Cordova错误:错误白名单拒绝
- .bind('all', 'update')上的主干怪异类型错误错误
- 错误:错误:语法错误,无法识别的表达式:
- Jqx图表给出错误错误:
属性高度=“-1”的负值无效 - mongodb mongodump json日期字段解析错误
- jQuery自定义验证只显示最后一个字段的错误
- WebGL错误-错误:WebGL:bindBuffer:buffer已包含元素数据
- 修复了在 PhoneGap 中使用 jQuery Mobile 的 jQuery 验证中导致错误错误的延迟回调
- AngularJS 1.3 - 错误:错误:modulerr 模块错误(使用 ng-view,$routeProvide
- AngularJS - 处理错误错误:[ng:areq] 在此特殊情况下 (?)
- jQuery outline文本字段显示错误
- jquery验证器比较2个字段的错误
- 如何解决IE 7和8中关于创建动态文件输入字段的错误
- Redux表单:提交空白字段导致错误
- AngularJS验证更新另一个输入字段的错误状态
- ExpressionEngine 2.8.1:在通道形式中,日期字段出现错误
- 将同一字段的错误消息放在不同的位置 jquery 中
- 如何捕捉Chrome字段验证错误事件
- 想要防止用户输入任何空间在文本字段提供错误时,他这样做
- 未捕获为什么twilio.异常,段数错误