ember.js

Ember: Suggestions welcome for handling inFlight errors

℡╲_俬逩灬. 提交于 2019-12-24 13:30:30
问题 I use Ember data with the REST Adapter. I want to make sure that in case of slow server responses, the application does not fail. I have simulated this bij adding at server side a sleep method of 5 seconds before returning the JSON response. If you have a form with a SAVE button, and you click this button while a previous save is still is progress, you receive a inFlight error and the whole Ember app freezes (only thing you can do is reload app). So, you can easily disable the save button by

Create and display EmberData models on same route/resource

随声附和 提交于 2019-12-24 13:24:26
问题 The app I am working on has an Event-page where users see Events from themselves and friends as well as being able to use an inline event-creator (to create events, on that very same page/route). To be a bit more precise, the events get all loaded and displayed in a newsfeed style, which works perfectly fine but the problem now is when trying to save a new event-model. I think some code will make this easier to understand. The routes: this.resource('newsfeed', function() { this.route(

Ember - Setting homepage title in controller or route?

送分小仙女□ 提交于 2019-12-24 13:18:35
问题 What is the best practice? This is my HTML: <script type="text/x-handlebars"> <div id="top-panel"> <h1>{{title}}</h1> </div> <div id="wrapper"> <div id="content"> {{outlet}} </div> </div> </script> Where should I set {{title}}? I found out there are two ways to do this... First: App.ApplicationRoute = Ember.Route.extend({ setupController: function (controller) { controller.set("title", "Foo Bar") } }); Second: App.ApplicationController = Ember.ObjectController.extend({ title: "Hello World" })

Ember Data belongsTo Association (JSON format?)

这一生的挚爱 提交于 2019-12-24 13:08:04
问题 I have two models 'Author' and 'Publisher' (Rails), with a publisher hasOne author / author belongsTo publisher relationship. I have the Ember models setup correctly -- JS Fiddle -- and the associations working when I manually push into the store. But only the publisher records are created when requesting /publishers index. I've tried several types of JSON responses: Publishers with author { "publishers": [ { "id": 1, "name": "Test P 1", "author": 1 } ], "author": { "id": 1, "name": "Test A 1

What is the ideal way to create view-instance-specific bindings in emberjs?

流过昼夜 提交于 2019-12-24 12:51:48
问题 I have a view that is instantiated in an {{#each}} block, so there are multiple instances. Each view needs to have a bound property to an object that is specific to that view instance. So the usual way of declaring a binding: App.hash = Ember.Object.create({ item1: "one", item2: "two" }); App.MyView = Ember.View.extend({ itemBinding: "App.hash.itemN" }); won't work because When I define what the binding maps to ( App.hash.itemN ) I don't know yet whether it should be item1 or item2

How to pass parameters in emberjs render method?

六眼飞鱼酱① 提交于 2019-12-24 12:42:38
问题 I am trying to pass parameters to a modal view while rendering it. Here is what I got so far: In my application route, I have: export default Ember.Route.extend({ actions: { openModal: function(modal, opts) { return this.render(modal, { into: 'application', outlet: 'modal' model: function(){ return opts }, controller: modal }); }, closeModal: function() { return this.disconnectOutlet({ outlet: 'modal', parentView: 'application' }); } } }); I have a general modal view: import Ember from 'ember

How are ember links to reused nested routes defined using link-to?

旧时模样 提交于 2019-12-24 12:40:31
问题 Using the example route defined below how can a link be defined to /post/123/comments? Router.map(function() { this.route('post', { path: '/post/:post_id' }, function() { this.route('edit'); this.route('comments', { resetNamespace: true }, function() { this.route('new'); }); }); this.route('comments'); }); Since resetNamespace: true is set on comments, the route post.comments does not exist. Otherwise the following would work. {{#link-to "post.comments" "123"}}Link{{/link-to}} When trying to

content.name returns empty for collection

只谈情不闲聊 提交于 2019-12-24 12:24:07
问题 I'm starting with ember.js and ran into trouble trying out things in the ember.js docs (http://docs.emberjs.com/symbols/Handlebars.helpers.html#.collection). This application code: App = Ember.Application.create() App.items = [ Ember.Object.create({name: 'Dave'}), Ember.Object.create({name: 'Mary'}), Ember.Object.create({name: 'Sara'}) ] with this template code: {{#collection contentBinding="App.items"}} Hi {{content.name}} {{/collection}} Results in this: <div id="ember122" class="ember-view

{{#link-to ‘routeName’}} with dynamic context

半世苍凉 提交于 2019-12-24 12:08:30
问题 Is it possible to use link-to with dynamic context params as a single variable? This works when there is 1 dynamic part, but in the example below i have post-category-id and post-id . Is it possible to pass these params in dynamically. It tried to pass them as array or as a String, but this is not working. In the example I want to {{#link-to "post" params}} where post is nested in post-category. My goal is to pass in params with the 2 context params needed. // router this.resource('post

Google one-tap log in with Auth0

久未见 提交于 2019-12-24 11:44:32
问题 We currently user AuthO as a platform to allow for google login and sign up on our site, but I want to start using the google one tap login https://developers.google.com/identity/one-tap/web/overview Is there a way for us to be able to set up the one tap log in while continuing to use Auth0 as a platform? The idea is to not have an external connection into google's identity and login/sign up features outside of our standard infrastructure. 回答1: Came across this looking for the same answer,