如何使用 ember-rails 启用 query-params-new 功能 [英] How to enable query-params-new feature using ember-rails
问题描述
我在使用 query-params-new 功能时遇到问题.
I am having trouble using the query-params-new feature.
我的 ember 版本是 1.4.0-beta.2.
My version of ember is 1.4.0-beta.2.
Ember.js 通过 ember-rails 和 ember-source gems 加载到我的 rails 应用程序中.
Ember.js is loaded into my rails app through the ember-rails and ember-source gems.
在初始化 Ember 应用程序之前,我像这样打开了该功能.
Before initializing the Ember App I turn on the feature like so.
Ember.FEATURES["query-params-new"] = true
这样做后,我在导航到任何路线时收到以下错误.
After doing so I get the following error when navigating to any route.
Error while loading route: TypeError: Object [object Object] has no method 'paramsFor' at Ember.Route.Ember.Object.extend.deserialize
我错过了什么吗?我需要在每条路线上定义一个 paramsFor 方法吗?
Am I missing something? Do I need to define a paramsFor method at each route?
推荐答案
我遇到了同样的问题,我注意到 this issue 提到了这个问题,并将其归因于滥用新的查询参数 API.您在哪里使用以前的实现?
I'm having the same problem, I noticed this issue mentioning the problem, and attributes it to misusing the new query params API. Where you using the prior implementation?
我的问题是我如何启用它.我遵循的是简单地将值传递给 Ember.FEATURES 的先前方法:
My problem was how I was enabling it. I was following the prior method of simply passing a value to Ember.FEATURES:
Ember.FEATURES['query-params-new'] = true;
但是,docs 现在指定了正确的方法(这也需要在 Emberjs 文件由浏览器加载):
However, the docs now specify the correct method (which also needs to happen before the Ember js file is loaded by the browser):
ENV = {FEATURES: {'query-params-new': true}};
这篇关于如何使用 ember-rails 启用 query-params-new 功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!