问题标签 [emberfire]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
151 浏览

javascript - Ember 数据和 Ember Fire 不同步复选框

我正在浏览 EmberJS 的教程并创建 TodoMVC:http ://www.thetechcofounder.com/getting-started-with-ember-js-using-ember-cli/

我没有使用教程中的 ember-cli-mirage,而是连接了 Firebase,其中大部分都很好用。我对使用 Firebase 的 Angular 和 Dart 很满意,但我才刚刚开始学习 Ember。

我正在努力解决未更新 Firebase 的复选框输入,我不知道从这里去哪里。

在我的组件中,我有

我的模型如下所示:

在 Chrome 中使用 Ember Inspector 我可以看到 ember 数据得到了适当的更新,但这种变化永远不会影响到 firebase。是否需要做一些特定的事情来将 Ember Checkbox 助手与 EmberFire 连接起来?

Ember 数据与 Firebase

2016 年 1 月 21 日更新

如果我向 ember 组件 todo-item.js 添加一个更改处理程序,我可以发送一个操作并让事情按预期工作。

不确定这是否是最合适的方式,但它现在让我前进。

0 投票
0 回答
152 浏览

javascript - EmberFire 查询等于“假”

我正在使用 Ember 2.3、EmberData 2.3.2 和 EmberFire 1.6.3

在我的 Ember 路由中,我返回了一个如下所示的 firebase 查询:

我的模型如下所示:

当我用 equalTo: true 查询 EmberFire 时,我得到了预期的结果,只返回已完成的项目。如果我用 equalTo: false 查询,它会给我所有的记录。

有没有更合适的方法来获取完整 === 错误的所有记录?

0 投票
0 回答
123 浏览

firebase - 使用 Emberfire 检测身份验证令牌过期

我的 firebase 令牌过期没有问题,但我想以编程方式了解这一点,以便确保 UI 在发生这种情况时以适当的方式响应。

在这种情况下,我注意到我收到以下消息:

resumeSession() 已取消:身份验证令牌已过期。

Ember SPA 如何与此事件挂钩?

0 投票
0 回答
293 浏览

ember.js - How to use auth in emberfire with torii intergrated

As per this merge torii has been merged into emberfire. There isn't much on the google about how to use it though. I've tried to look at some of the integration tests in emberfire to figure it out, but to no avail.

I'm looking for an implementation similar to the old approach, or really just anything that works:

Where you can the use session in your .hbs templates. Can anyone point me in the right direction / give an example?

0 投票
0 回答
35 浏览

ember.js - Emberfire 设置记录优先级

有没有办法在 emberfire / EmberJS 中设置 Firebase 记录的优先级?到目前为止,谷歌搜索只返回了关于如何查询优先记录的答案。

0 投票
2 回答
820 浏览

session - 刷新后 Torii 会话不会持续存在

目前,我的 Ember-cli 应用程序在刷新后注销。我已经修改了很多代码以尝试使其正常工作,但没有任何帮助。如有必要,我将尝试使用其他提供商实现身份验证。

我有一个应用程序路由,它只是注销和登录路由,它处理登录,因为客户端想要对其进行样式设置。

我的 config/environment.js 文件如下所示:

应用程序/适配器/application.js:

应用程序/鸟居适配器/application.js:

应用程序/路由/application.js:

应用程序/路由/login.js:

是的,目前,登录和注销工作正常,但我无法在会话中间刷新页面,否则它会自动注销我。

提前感谢任何人。

0 投票
1 回答
187 浏览

ember.js - 自定义键下的 Emberfire 保存记录

是否可以使用createRecord()并指定自定义键来保存新记录来保存新记录?目前使用时与在javascript框架createRecord()中使用相同。push()

显然如下:

使用类似于 的键创建新记录-KBCqhu4mhvl6xNfSRD3

我的问题是我的一些密钥位于不同的端点,我希望这些密钥与用户的 ID 相同。

为了进一步澄清,这是我希望我的 Firebase 结构最终成为的示例:

让我知道我是否可以进一步澄清

0 投票
1 回答
117 浏览

ember.js - 如何使用 EmberFire 保护我的 Firebase 应用构建

我为 Firebase 安全工作如我所愿而挠头。我的应用是用 Ember 和 EmberFire 构建的。所以结构是由 EmberFire 决定的。

我的数据库结构如下:

我想要的是只有参与对话的用户才能在此对话中查看和编写消息。我尝试了这条规则但没有成功:

似乎 auth.uid 不能传递给 hasChild。我还尝试了以下方法,因为我的对话 id 是参与对话的用户 id 的加入:

使用此规则,没有人可以看到对话,因为“对话”节点没有 .read 规则。但是,如果我将“.read : true”添加到“对话”节点,由于 Firebase 中的上下规则,所有用户都可以看到所有对话。

编辑:第二条规则与第一条有相同的问题。beginWith() 需要一个字符串参数。而且 auth.uid 不能用来解决我的问题有什么想法吗?

编辑:在规则之前添加 auth !== null ,使得错误 beginWith() 需要一个字符串参数出来。但是这两个规则仍然不起作用。

0 投票
1 回答
1313 浏览

javascript - Ember.js: make current user globally accessible

I am writing an ember app (using ember 2.3.0) using emberfire & torii for authentication. After a user logs in, their uid is available to me in the torii session object. I also have a user model and would like to access other data related to the current user in my templates, routes, etc.

I can get this to work in a single route by doing something like:

but would like to prevent having to write this for each route/controller that needs to access it.

Could anyone advise on the best way to do this? Is the best way to use a service? If so, how can I ensure that the code in my service is executed after my session object is available?

Update

I managed to get my application to work with the following solution:

Create a method to login user using firebase

I created a mixin to handle the logging in behaviour. This is then used on both the login page and the sign up page.

Create a user service

This is used to associate the user model with the authentication user.

app/services/user.js

Inject user service into application route

The application route is called whenever the application is loaded (when the user refreshes the page for example). Therefore, as @Deovandski mentioned in his answer, you need to inject it on the Application route in order for the user account to be available globally.

app/routes/application.js

Inject the user service wherever it is needed

You can then access the current user in the following manner:

0 投票
1 回答
36 浏览

ember.js - Ember 构建后保存用户对象中断

我有一个使用 Firebase 后端(Emberfire 适配器)构建的 Ember JS 调查应用程序。

以下代码在开发时可以正常工作:

但我这样做的那一刻:

尝试保存用户对象时会引发错误。引发错误的具体位置是当我尝试添加到 respSetSurveyLookup 数组时。

不幸的是,由于错误消息在缩小的 JS 代码中,因此我无法沿着堆栈跟踪进行工作。

所以我的问题是,只有在完成 ember 构建时才可能导致用户对象保存失败?这是由 Ember CLI(构建)引起的问题吗?还是与 Firebase Emberfire 适配器有关?

附加信息:我使用的是 Ember CLI 1.13.13、Ember 1.13.11 和 Ember 数据 1.13.11。