我的应用程序并不是从enviroment.js文件中加载所有参数,而是默认情况下加载的参数。
我安装了这个包烬-g-re验证码,然后您需要在配置文件中放置一个param。
问题是,我创建了一个演示应用程序的烬-cli和我不工作,但在我真正的应用不是,也许有人知道为什么没有加载的帕拉姆。
我尝试更改package.json中模块的版本,但没有成功,但我认为解决方案仍然在那里。
在我的应用程序中,当您执行此控制台日志时,配置文件的对象抛出此文件:
console.log(Ember.getOwner(this).resolveRegistration('config:environment'));
Object {
modulePrefix: "listings-search",
environment: "development",
rootURL: "/",
EmberENV: Object,
APP: Object, ember-cli-mirage: Object, exportApplicationGlobal: true
}在演示应用程序中,这是结果:
Object {
modulePrefix: "lala",
environment: "development",
rootURL: "/",
locationType: "auto",
gReCaptcha: Object,
EmberENV: Object,
APP: Object, ember-cli-mirage: Object, exportApplicationGlobal: true
}这是我的enviroment.js文件
/* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'listings-search',
environment: environment,
rootURL: '/',
locationType: 'auto',
gReCaptcha: {
siteKey: 'asdasdads'
},
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Date: false
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
// ENV['ember-cli-mirage'] = {
// enabled: false
// }
}
if (environment === 'test') {
// Testem prefers this...
ENV.locationType = 'none';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
}
if (environment === 'production') {
}
return ENV;
};同样,当我试图以官方指南在这个environment.js中所说的方式访问我的链接时,将这个错误抛到控制台中:
Could not find module `/appname/config/environment` imported from `appname/components/name-component`版本:
发布于 2017-07-24 21:26:37
问题是Ember.js将Enviroment.js文件插入到HTML中的元标记中,我对此一无所知,因为文档中没有提到这一点。
我们使用了不同的策略来使用are而不使用路由,因此元标记在代码中被重新编码。我没有看到它(我也没有注意到这一点,因为我不知道元标签中的配置参数)
由于(ember-cli-build.js) 2.3可以设置在花椰菜文件Ember.js中,参数storeConfigInMeta: false和配置文件将嵌入到Ember.js文件中。
https://stackoverflow.com/questions/45206402
复制相似问题