ember.js

store.filter() not working as expected ember.js (Trying to search models)

跟風遠走 提交于 2019-12-20 04:41:22
问题 I am trying to implement a search system here and I am having some trouble with store.filter() First of all I can't find any good documentation on the store.filter() method aside from here: http://emberjs.com/guides/models/frequently-asked-questions/ So I am using the example provided on that page as a guideline. This is what I have in my code App.ApplicationController = Ember.ObjectController.extend({ isDropdown: false, actions: { handle_search: function() { var search_text = this.get(

Ember - Transition to same route with same model

╄→尐↘猪︶ㄣ 提交于 2019-12-20 04:15:27
问题 I have a left tree list, and each item in the list opens same route with different model. What i want is, if i click on the same item again and again, i want the route to load again. I know ember doesn't normally function this way. Are there any tweaks to achieve this? Update: Left tree is parent route.On clicking items in left tree, child route is loaded in its outlet. My left tree will be structured like this, item1(link to bodyRoute1 with model1) item2(link to bodyRoute1 with model2) item3

emberjs action event.target is undefined

蹲街弑〆低调 提交于 2019-12-20 04:13:38
问题 Here's a link to a jsfiddle: http://jsfiddle.net/Qt972/ When you run the fiddle you'll see a name and a button to make the "person" say hello. This works fine, however the "event" is undefined. An even simpeler case also fails: http://jsfiddle.net/CCg2K/1/ Does anyone know how I can fix this issue? 回答1: When you do a console.log(arguments) inside your action callback you can see that there are actually 3 parameters passed. The first one is the view, the second is the event and the third is

Ember serve: every port is in use

萝らか妹 提交于 2019-12-20 03:49:10
问题 When I specify no port or set the port explicitly, I always see: ember serve --port 4207 Port 4207 is already in use. It doesn't seem to matter which port I pick. When I start with port 0 (let the cli pick an available port) it starts on on something around 30000~40000. I am on a Mac. I just upgraded my ember-cli to 3.12.0 Also: If I start another ember app I have locally, it will run on port 4200. But then I stop it and start the above app and it won't start on that port. What is wrong here?

Injecting dependencies into an Ember model

独自空忆成欢 提交于 2019-12-20 03:44:09
问题 I'm attempting to inject dependencies into my Ember models. https://github.com/emberjs/ember.js/issues/3670, states that this is disabled. Following a link to https://github.com/stefanpenner/ember-cli/blob/master/blueprint/app/app.js#L4 demonstrates how to enable MODEL_FACTORY_INJECTIONS , which in theory, should allow me to inject dependencies into my models, however I'm having no luck. In the absence of this solution, are there other ways to inject a ref to an app-wide, global singleton

How to specify compression for custom build environment in Ember

吃可爱长大的小学妹 提交于 2019-12-20 03:42:32
问题 How do I specify compression, bundling and adding invalidation hashes to filenames for a custom environment? The production environment will automatically compress and consolidate files and add invalidation hashes to the file names. I.e. whenever I use ember build --environment=production to trigger the if (environment === 'production'){} case in config/environment.js But I want to create and build for a QA environment that also compresses files and adds invalidation hashes to file names. I.e

Using `afterRender` hook with nested views

对着背影说爱祢 提交于 2019-12-20 03:22:09
问题 Here is the jsFiddle if you like to see code first What I want to do is simple: execute some (actually a lot) of view layer Javascript code from jQuery and jsPlumb libraries after ALL the views in the current route have finished rendering. After getting some help from this solution and finding that ember-latest has just been updated to include afterRender hook, I decided to upgrade. I now have the almighty afterRender hook. All the views I am inserting into the dom have a block class

Emberjs 1.x-pre- Ember.Router and Ember.computed issues

霸气de小男生 提交于 2019-12-20 03:12:09
问题 I was reading http://code418.com/blog/2012/03/26/advanced-emberjs-bindings/ and came across Ember.Binding.and for transform which has deprecated in the current emberjs for Ember.computed . I decided to update the old emberjs 0.9.x fiddle http://jsfiddle.net/Wjtcj/ to work with emberjs 1.x and provided an Ember.computed.and as shown in the new fiddle http://jsfiddle.net/Wjtcj/5/ . Though it works, i cant make it return thesame output as the old one but when an improved version of the code http

ember.js #each order by property

我的梦境 提交于 2019-12-20 02:56:32
问题 I have an array of Ember.Object s which is displayed by Handlebars {{#each}} helper which I want to be sorted by an property of those objects everytime the array changes. So something like this: var arr = [ Ember.Objects.create({ position:0, label:"foo" }), Ember.Objects.create({ position:1, label:"bar" }), ]; And the handlebar {{#each arr}} <div class="label">{{label}}</div> {{/each}} So if I update the positions and the bar object becomes first, I want the view to be updated. Can I depend

Concatenation string with variable in emblem.js

被刻印的时光 ゝ 提交于 2019-12-20 02:56:13
问题 I need in Emblem.js to transmit to i18n helper concatenated string constant with variable value, How can i do it? each item in model.items div t "dict.{{item}}" returns error Missing translation for key "dict.{{item}}" 回答1: If you're using Handlebars 1.3+, you can use a subexpression. First, write a string concatenation helper: Ember.Handlebars.helper('concat', function (a, b) { return a + b; }); Then use it like this (sorry, I don't know Emblem so I'm going to use the normal stache syntax):