ember.js

Emberjs custom config variables

不羁的心 提交于 2020-01-14 05:44:10
问题 How would one specify a custom config variable for use in the handlebars template? For example: // config/settings.json { "title": "Hello World" } // config/foo.json { "bar": "baz" } // Template {{ settings.title }} {{ foo.bar }} 回答1: You need to use dependency injection to inject you global variables into the controller. This blog post from Balint Erdi explains it well. Here is a working demo. This is basically what you do Create 2 object - settings and foo. var settings = Ember.Object

How to display post's delete button for only post's author in Ember.js

一个人想着一个人 提交于 2020-01-14 04:42:06
问题 Hello I've been stuck for days how to display a post's delete button only for the post's author in Ember.js (I'm using ember-cli to build this). I don't know where to put the logic of " When hovering a post (list), if the post's author is equal to currently logged in user, then display the delete button " I am lost. Please help me. in template app/templates/posts.hbs {{#each}} <div class="eachPost"> {{#view 'posts'}} <div class="postProfilePhoto"> {{#link-to 'users' }} <img src="" alt=

Ember-Simple-Auth with Torii access user info

只愿长相守 提交于 2020-01-14 03:46:07
问题 I've been working all week to get authentication working. I have gotten it working with Ember-CLI Ember-Simple-Auth Torii google-oauth2 provider However I have proven unsuccessful in getting the users information from google. I have tried creating a torii-adapter as stated in their documentation but it doesn't appear to be called // app/torii-adapters/application.js export default Ember.Object.extend({ open: function(authorization){ console.log('authorization from adapter', authorization); }

Is using javascript setters and getter properties to watch for changes a bad idea?

守給你的承諾、 提交于 2020-01-14 03:24:05
问题 Using Object.create one can define setter and getter methods in javascript. o = Object.create(Object.prototype, { fooBar: { get: function() { return "Meh" }, set: function(value) { console.log(value) } } }); console.log(o) will always return Meh, and doing o = "Heyo" would only output the new value directly without changing o . Is there any reason as to why I should not use, or rely on this behavior to trigger events? What about two-way binding frameworks like angular and ember, do they make

with Ember Data, how do you call commit?

北城以北 提交于 2020-01-14 02:51:33
问题 I am trying to build a simple Todo List using all the last routes and data stuff for ember. You can find my full repo here I have my store set up like so: EmberTodo.Store = DS.Store.extend({ revision: 11, adapter: DS.RESTAdapter.create({bulkCommit: false}) }); The line of code that is giving me trouble comes from here: EmberTodo.CreateItemView = Ember.TextField.extend({ insertNewline: function() { EmberTodo.Item.createRecord({description: this.get('value')}); this.set("value", ""); } }); From

Authentication failed - Permission Denied with EmberFire

非 Y 不嫁゛ 提交于 2020-01-14 01:47:03
问题 I'm trying to set up a basic datastore at firebase when following simple beginner tutorials on Ember js 2.0. For example I am following this tutorial: https://medium.com/@jamesfuthey/a-gentle-introduction-to-ember-2-0-8ef1f378ee4#.d6umfj62j I always seem to have a problem with authentication with the Firebase URL. That is, I've gotten to the bit where this tutorial tries to write information to my firebase project, but the Chrome Inspector shows I'm getting a 'permission denied' error from

Authentication failed - Permission Denied with EmberFire

限于喜欢 提交于 2020-01-14 01:46:07
问题 I'm trying to set up a basic datastore at firebase when following simple beginner tutorials on Ember js 2.0. For example I am following this tutorial: https://medium.com/@jamesfuthey/a-gentle-introduction-to-ember-2-0-8ef1f378ee4#.d6umfj62j I always seem to have a problem with authentication with the Firebase URL. That is, I've gotten to the bit where this tutorial tries to write information to my firebase project, but the Chrome Inspector shows I'm getting a 'permission denied' error from

Ember - Abort ajax request

廉价感情. 提交于 2020-01-13 20:22:31
问题 I want to know how to abort a request. For example, I issue App.MyModel.find() and later i want to cancel/abort it before it returns from server. I would expect something like this: var res = App.MyModel.find(); //request sent to server res.abort(); // abort the request before completion but this doesn't work - the returned object is a promise and there is neither abort nor cancel methods. Clarification I'm looking for how to call the abort method on the underlying XMLHttpRequest object. 回答1:

Ember - Abort ajax request

大兔子大兔子 提交于 2020-01-13 20:22:17
问题 I want to know how to abort a request. For example, I issue App.MyModel.find() and later i want to cancel/abort it before it returns from server. I would expect something like this: var res = App.MyModel.find(); //request sent to server res.abort(); // abort the request before completion but this doesn't work - the returned object is a promise and there is neither abort nor cancel methods. Clarification I'm looking for how to call the abort method on the underlying XMLHttpRequest object. 回答1:

Best way to namespace multiple or suit of emberjs apps

寵の児 提交于 2020-01-13 19:53:49
问题 First a Merry Xmas to you and thanks for helping with suggestions. My question is still on emberjs namespace but this time in the context of a suite of multiple emberjs apps which will be contained within multiple rails-engine, so that each emberjs app is a standalone app with its own controllers, models, views and routers. However, they will still need to share ember-data associations. These rails-engines will inturn be included in the main-rails app where each engine represents a major