我有一个非常重的Ember-CLI应用程序.
我开始使用Ember Forms来帮助进行布局和模板化,这很好,似乎工作正常.
显然需要验证,它还需要Dockyard的Ember-Validation ......这种特殊的依赖关系似乎安装方式不同而且我对如何执行此操作感到迷茫.
我习惯使用简单的东西bower install ...,然后只添加依赖项brocfile,但在这种情况下,Dockyard提供了一个庞大的构建列表供我们选择,我不知道使用哪一个?
有没有人有经验在ember-cli项目中安装ember-validation并且能够很好地使用ember-forms?或者它实际上可能比我想象的更简单,而我只是被所有构建选中而被抛弃?
我刚才,在ember-cli中更改了我的路由结构并破坏了我的应用程序.我想把我目前的结构更深一层......
之前:
Router.map(function() {
this.resource('placements', function() {
this.route('add');
this.route('import');
this.route('open');
});
this.route('admin');
});
Run Code Online (Sandbox Code Playgroud)
后:
Router.map(function() {
this.resource('portal', function() {
this.resource('placements', function() {
this.route('add');
this.route('import');
this.route('open');
});
this.route('admin');
});
});
Run Code Online (Sandbox Code Playgroud)
我的模板结构也需要改变......
之前:
- templates/
- placements/
- add.hbs
- import.hbs
- index.hbs
- open.hbs
- admin.hbs
- application.hbs
- index.hbs
- placements.hbs
Run Code Online (Sandbox Code Playgroud)
后:
- templates/
- portal/
- placements/
- add.hbs
- import.hbs
- index.hbs
- open.hbs
- admin.hbs
- index.hbs
- placements.hbs
- application.hbs
- index.hbs
- portal.hbs
Run Code Online (Sandbox Code Playgroud)
我以为我已经做了一对一的所有更改,但出于某种原因,当我重新启动ember服务器时,嵌套的"展示位置"路线被破坏了.
在 …
我有web app和Ember appiframe.我想从自定义库导入web app到ember app类似的全局变量.库看起来像具有功能的对象:
var helpers = {
helper1: function() {},
helper2: function() {}
};
Run Code Online (Sandbox Code Playgroud)
库使用套接字,对于两个应用程序都是一样的.
我写:
app.import("./../../../public/scripts/js-helpers.js"); //file located in web app
Run Code Online (Sandbox Code Playgroud)
我无法访问helpersproject和ember-cli copy文件夹中的变量public到他们的工作文件夹中.对不起,如果问题是愚蠢的,我无法理解ember-cli导入原则.
我在Ember CLI应用程序中定义了一堆模块,每个模块都以相同的路径开始.我想将模块导入应用程序中的模块.例如,我可以写:
import post1 from 'posts/1';
import post2 from 'posts/2';
import post3 from 'posts/3';
export default Em.ObjectController.extend({
posts: Em.A(post1, post2, post3),
});
Run Code Online (Sandbox Code Playgroud)
但是,我不知道模块名称,因为它们是由预编译器即时创建/命名的.我所知道的是路径总是以相同的字符串开头.在这种情况下,posts.
有没有办法导入以特定路径开头的所有模块?例如,我该怎么办的东西像下面这样:
import posts from 'posts/*';
// or
registry['posts'].forEach(postId, i) {
var path = 'posts/' + postId;
import i from path;
}
Run Code Online (Sandbox Code Playgroud)
我想要查找和导入的每个模块都导出了一个对象.
我已经通过ES6模块转换器文档,但找不到多少.
安装Bower组件时出错,引发以下错误
Request to https://bower.herokuapp.com/packages/ember failed: SELF_SIGNED_CERT_IN_CHAIN.
Run Code Online (Sandbox Code Playgroud) 我正在将我的Ember CLI插件从0.1.9升级到0.2.0,并在运行时遇到此错误ember test --server:
ReferenceError:无法找到变量:在http:// localhost:7357/assets/test-loader.js,第3行定义
ember serve工作,我可以/tests在浏览器中访问,但其他东西似乎打破了testem /幻像设置.
我已经升级了Phantom,并且经历ember init了几次差异,但我仍然必须遗漏一些东西.
我使用的灰烬CLI默认情况下它似乎设置Ember.MODEL_FACTORY_INJECTIONS = true;在app.js.
我尝试将此行注释掉(并将其设置为false)然后我的应用程序似乎表现出某种严格的模式.我得到了一堆失败的断言,因为我的一些模型关系没有明确指定逆.
这是确切的错误:
You defined the 'account' relationship on (subclass of DS.Model), but multiple possible inverse relationships of type (subclass of DS.Model) were found on (subclass of DS.Model). Look at http://emberjs.com/guides/models/defining-models/#toc_explicit-inverses for how to explicitly specify inverses
使用默认的Ember CLI生成的应用程序Ember.MODEL_FACTORY_INJECTIONS = true;,我没有收到这些错误.所以我会相信这个标志会以某种方式改变核心行为.
洞察力!
标题几乎是我的问题.我以dist不同的方式提供目录,并且仍然喜欢自动构建的好处,但我不需要运行服务器.我查看了文档和cli帮助,但没有看到任何具体的内容.我知道cli帮助不包含所有内容,因为它没有列出ember build可用的内容.
在Ember中创建自定义错误类的正确方法是什么以及将错误类定义文件放在Ember CLI中的位置?
我发现的所有代码示例都在乱搞JavaScript对象原型.为什么我不能像正常的Ember对象一样调用Ember.Error.extend?
自定义错误类的正确位置应该在app/errors /目录下,但似乎Ember CLI没有解析这些文件.
这是.ember-cli文件.
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.
Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
}
Run Code Online (Sandbox Code Playgroud)
Ember CLI默认情况下将分析发送给谁?