ember.js

Migrate Routes from Rails to Ember with Existing Rails Application using “ember-rails”

人盡茶涼 提交于 2019-12-12 12:52:59
问题 Using gem "ember-rails" for an existing rails app. I'm attempting to route one resource using Ember, and I've been told by a number of people that this code should work, but it's not. I want to breakthrough the learning curve and make this work, but I need some help. Error Routing Error No route matches [GET] "/newslinks" Code application.js //= require jquery //= require jquery-ui //= require jquery_ujs //= require jquery-fileupload/basic //= require jquery-fileupload/vendor/tmpl //= require

Using handlebars end-up displaying nothing

蓝咒 提交于 2019-12-12 12:15:08
问题 First, I'm a new user so if this is not the place to ask this question or the question is leaking with details please inform me and I'll do the required adjustments. I'm new to Ember.JS and I've recently started learning by reading this getting started guide. In the early stages of this guide I'm already dealing with the next problem: All stages worked well until the stage where I need to update my index.html to wrap the inner contents of <body> in this Handlebars script tag: <script type=

Binding static and dynamic classes with HTMLBars

感情迁移 提交于 2019-12-12 12:06:23
问题 I'm trying to bind a static class 'form-control' and a dynamic property value 'color' to the class attribute of an input helper, however, the syntax I'm using just outputs this to the rendered DOM element class="form-control {{color}}" without actually binding the value of 'color' to the class attribute. I know that this is the way to bind static and dynamic classes in normal DOM elements with HTMLBars, but is there a different syntax for elements that use curly-braces? The syntax I'm using:

Ember yield param passing

南楼画角 提交于 2019-12-12 12:05:14
问题 I'm trying to pass an argument to a yield block, however I missing something that I don't see. Here is the case: components/table-notes.hbs <table> ... <tbody> {{#each note in notes}} <tr> <td>{{yield note}}</td> ... </tr> {{/each}} </tbody> </table> elsewhere {{#table-notes notes=model.notes}} //do something with each note {{/table-notes}} Is it anything wrong or incomplete with this param passing? Thanks in advance. 回答1: I don't think you can do this in a version prior to 1.10. In 1.10

RSVP - Handling timeouts with promises

a 夏天 提交于 2019-12-12 12:03:48
问题 I am using ember.js and RSVP. From what I can see, there is nothing that handles a timeout from an async call. My thinking is to wrap the resolve handler using the decorator pattern to wrap the resolve handler in some code that will time the call and call reject if the timeout happens. Does this sound like a good idea or is there some built in support for timeouts that I have missed in RSVP. 回答1: You can do that, but this should probably be handled by whatever is doing the async operation. If

Refresh / Reload ember route from a component

谁说我不能喝 提交于 2019-12-12 11:27:55
问题 I have a component, that's actually a modal dialog. When I am done with that dialog and press the "Ok" button, I want to stay on the stay page from where I opened that dialog. Which isn't difficult. But the problem is that the dialog changes the data (I am getting data through a REST call) so I need to refresh the route that I already am on to reflect the data changes. Since, I am calling it from a component, I don't have Route so can't call route.refresh() . I tried to get the router: this

EmberJS: Object as Query Param to Refresh Model

青春壹個敷衍的年華 提交于 2019-12-12 11:19:25
问题 I followed the Query Params guide (http://guides.emberjs.com/v1.11.0/routing/query-params/) and it worked great. Specifically, refreshing the model did exactly what I wanted. I'm moving the filter to the json-api spec and filtering takes place in a filter object. So rather than: http://localhost:3000/accounts?id=1 The server responds to: http://localhost:3000/accounts?filter[id]=1 I tried to get the query params to work refreshing the model based on an object, but it doesn't seem to update. /

Ember cleanup on leaving route

孤街醉人 提交于 2019-12-12 10:56:42
问题 I want to make some cleanup when i leave route, like stopping timers. For that i need an event that triggers when leaving the route, and i need access to instance of controller inside of that event. There is an exit event, but it doesn't get any arguments, and this.get('controller') inside it doesn't work too - returns undefined . Is there a proper way for obtaining controller instance in the exit event, or, maybe, another event that i don't know of? I setup this fiddle with an example of

Making Loopback API Ember.js compatible

家住魔仙堡 提交于 2019-12-12 10:46:43
问题 I'm trying out Loopback for an API that will talk to Ember. Ember requires JSON to be contained in 'keys', e.g. for an account: { account: { domain: 'domain.com', subdomain: 'test', title: 'test.domain.com', id: 1 } } I've found some advice on the Google group about how to alter the response so that Ember will receive it, using afterRemote hooks. E.g. in my models/account.js: module.exports = function(Account) { Account.afterRemote('**', function (ctx, account, next) { if(ctx.result) { if

Binding Action in Ember.Select

余生颓废 提交于 2019-12-12 10:46:30
问题 I was wondering how to bind an action in an Ember.Select só when the user change the category i could perform other operations: {{view Ember.Select class="form-control" id="PackCategory" content=Categories optionValuePath="content.categoryId" optionLabelPath="content.name" value=VendingAdminController.selectedPack.categoryId}} and also how to specify the view as the target? Thank you 来源: https://stackoverflow.com/questions/25490556/binding-action-in-ember-select