FAQ Database Discussion Community


Refactoring Computed Properties on Ember.js 1.13

ember.js
I was able to upgrade most of my Ember.js project to 1.13 after having some issues along the way, but now I can't wrap my head around the following deprecated code: filteredPosts: function(){...}.property('var1','var2','var3') When I enable it, the only notice that I receive is: Uncaught TypeError: controllerClass.proto is not a...

Cannot set property 'all' of undefined

javascript,ember.js,ember-data,jsonserializer
I'm having a problem getting a response form an API in my Ember.JS application. I'm using a "dummy" API just to learn Ember with and I didn't feel like creating my own back end (this one specifically). Whenever I try to navigate to the Posts template I get the following...

Emberjs get facebook friendlist

facebook-graph-api,ember.js,ember-data
I'm using Emberjs, Ember Simple Auth, and Torii (for the facebook-oauth2 provider). I was able to create a Facebook login and logout following this tutorial http://www.programwitherik.com/ember-simple-auth-torii-example-application/ For learning purposes, I'm trying to get my Facebook friendlist using the Ember Simple Auth and Tori not sure how to set up the...

Using this.store.filter with the ID of the belongs_to model

ember.js,filter,belongs-to
I'm trying to retrieve all the layouts for a given account. /app/models/account.js import DS from 'ember-data'; export default DS.Model.extend({ companyName: DS.attr('string'), layouts: DS.hasMany('layout') }); /app/models/layout.js import DS from 'ember-data'; export default DS.Model.extend({ name: DS.attr('string'), account: DS.belongsTo('account', { async: true }) }); /app/routes/layouts.js import Ember from 'ember'; export default Ember.Route.extend({ model:...

Computed Property not working

ember.js,controller,ember-data,computed-properties
I'm writing the todo app and I can't get computed properties working. I want to implement computed properties in the todos/index controller so that the template can appropiately display the amount of todos undone remaining (based on the isCompleted attribute of the models). This is the code: todos/index.hbs {{input type="text"...

How do you get around ember-sauve notifications about Ember params not being camelCase?

ember.js,dockyard
Ember route params have the convention of being underscore, however, ember-suave/jscsrc complains about these params not being camelCase. How do you fix/get around this issue? Also related, how do I ignore this camelCase message created from third-party plugins that I have no control over with api's that use underscores instead...

How to bind response of Ajax request to Model in EmberJs?

javascript,ruby-on-rails,ember.js,coffeescript,emblem.js
I am new to Ember, I have a running application where I need to put Chat app in it. I need to have list of last messages of different users from Chat model (Rails end) {Done} On clicking any message I will have a list of conversation of that particular...

Dynamically change link-to routeName

ember.js
tl;dr: How to fix this: http://emberjs.jsbin.com/pazece/4/edit ? I need to dynamically change routeName of link-to helper. The motivation here is to create back button in bread-crumb navigation. Problem arrises when my application transitions from route having one dynamic segment to route with multiple dynamic segments. This results in multiple #if...

Bind more controller properties to one attribute using HTMLBars

ember.js,htmlbars
is this correct or is there any other solution? <input disabled={{model.isnValid}} disabled={{isSaving}}> I know that I can create new CP and depend on model.isnValid and isSaving, but I want to know if there is any other solutions. Thank you for advices...

Ember self-reference and polymorphism

ember.js,ember-data
there is a user model which also relates to itself as contact so user has_many contacts. Than each contact has and belongs to many "groups". Both user and contact has one address. I read through http://lukegalea.github.io/ember_data_polymorphic_presentation/#/ couple of times, but yet still do no understand how to setup { user...

Recreate Similar Travis CI Console Log Interface

css,ember.js,travis-ci
The first time I saw the Travis CI live updating build console log, I was, I'll admit, nerdily impressed. And I know with some very time consuming CSS styling and JS coding, I could probably get something half as nice. But, my question is, are there any libraries out there...

Where did my data get stuck in Ember?

ember.js,ember-data,ember-cli-mirage
I'm trying to learn ember but having a hard time finding out why my data from the backend is not showing up. I'm using Ember Data with mirage fixtures. The data is showing up. Only if I introduce simple relationships the data from those relationships is not showing up in...

Saving an html object to firebase

javascript,canvas,ember.js,firebase,emberfire
I'm working in ember.js my project has an image cropping mechanic. This returns to me by default a canvas object and some data necessary to redraw the cropped image. But when I try to save the canvas object to firebase it saves it as something like [htmlObject Canvas] or something...

Ember.js execute action when clicking browser back button

ember.js,ember-data
I need to execute an API call when user clicks on the back button in the browser and then redirect to a route based on backend response. I've read about location API but I can't figure out how to distinguish between url changes due to clicks on link and url...

Unbind an event bound with Ember.run.bind?

ember.js
I have a component that has to react to viewport changes. The naive approach would be to just bind a jQuery resize listener, but that could mess with the Ember run loop. The best practice approach is to use Ember.run.bind This works just fine, but I wonder how to unbind...

Ember Data “modelFor” error when serializing models

ember.js,ember-data,ember-cli
I am using ember 1.13, ember-cli and ember data 1.19.1 and I am experiencing an error that is difficult to track down due to being unspecific. The error occurs when I do the following: this.get('model').forEach(function(mymodel) { applications.push(elavonApplication.serialize({includeId: true})); }); where "elavonApplication" is an instance of a DS.Model called "elavon-application" and...

How do you force Ember to rerender a component?

javascript,jquery,ember.js
I have an Ember component that uses jQuery to add a canvas chart. When I change routes, I get a new model, but Ember's automatic rerendering does not work in this case. In fact, I don't know how to make the component code which adds the chart re-run at all....

How to get the clicked element on Ember Component

ember.js,ember-cli
I'm learning EmberJS, I tried to search the docs and stuff but I couldn't get it right so far I've implemented the component and a action to respond on click event, for now it just print something in the console. I want to get the clicked element so I could...

Defining buildURL depending on what properties have changed

ember.js,ember-data
I would like to redefine my buildURL depending on what properties changed on the same model. For example, if the status changed, I would like to PUT to a certain route, and if the subuser changed, I would like to PUT to another route. Example : this.store.find('conversation', conv.id).then(function(conversation){ conversation.set('status', 'opened');...

return first element from array as computed property from Ember controller subclass

javascript,arrays,model-view-controller,ember.js
I am trying to return the first element of my array as a computed property to my template from my controller. My code is below. I am 100% about my array and template. Problem is my syntax about in the controller. Basically my array is works made of Work objects....

Load and unload multiple components in a sidebar using Ember

ember.js,ember-cli
I have a page where a user is building up an order for a customer. At various stages of the order they may get to a point where they need to add something else. For example, when selecting an address for the customer the customer may have a new address...

Getting the model inside a controller emberjs

javascript,ember.js,ember-data
I need to get the grand total price of all the objects returned from a JSON API. my idea is to create a controller and set a property on it. Then grab the model loop over each object and add to the predefined property that objects total price. Something like...

Ember.js binding to and saving belongsTo property

ember.js,ember-data
I have two models related to one another via belongsTo (a reciprocal relationship, i.e. 1:1) utilizing the async property. Having retrieved one record and setting it to the Model on the router, I have access to the properties in the main record and its associate—everything works fine there. I've used...

In Ember how can I create a component by name programmatically

ember.js,ember-cli
I can find lots of examples on how to create a component in Ember programmatically and add it to the DOM like this: var comp = App.FooBarComponent.create(); comp.appendTo('#someArea'); But what would you do if you wanted to do it by a name provided? var componentName = 'FooBar'; var comp =...

Custom API calls with Ember Data

ember.js,ember-data,ember-cli
I don't know if this is possible with Ember data, although I am kind of doubtful, but the API I am working with supports being able to produce 'or' queries by hitting URLs like, /v1/subjects?first_name||last_name=*dr* this would result in a query that looks like select * from subjects where first_name...

Can we access Ember.TEMPLATES in controller?

javascript,templates,ember.js
Is it possible to use Ember.TEMPLATES to check the existence of a template within a controller or component? I am using v1.12.1 We are currently transitioning to a route that is rendering a template that may not exist. Prior to the transition, we need an existence check of the template...

Assign two actions to one element in Ember.js

ember.js
<span {{action 'toggleChildren' 'ServerObjects'}} {{action 'contextMenu' on='contextMenu'}}>{{server.name}}</span> Unfortunatelly when I add this second action, the first one stops working. I can't find a way to assign two actions to one element. I found this topic: Ember : handling multiple events with {{action}} tag? . Does it still apply?...

Ember Routing Model Observing Updates in Handlebars Template

ember.js,ember-data,ember-cli
How do I update a model property once a promise (via Ajax call) has returned? Here is my go at it that is not working. In the docs, it appears observing takes place using Ember.set but the model I am returning is not an Ember model object so I don't...

Bootstrap table's styles messed up when used with Ember.js

html,css,table,ember.js,bootstrap
I work with bootstrap. When I create a table in plain HTML, bootstrap's table styles are applied as expected. But, when I insert the same HTML into an Ember.js template, the bootstrap's table styles don't seem to apply (e.g. table borders, paddings and stripes are not present). Fiddle: http://jsfiddle.net/5evymbou/ Plain...

Retrieving rendered json from ember .save() method

ember.js,ember-data
My rails backend renders a json response when I call .save() on my model. When doing a jquery ajax PUT request like this, I can retrieve the data returned (see below, data parameter) : $.ajax({ type : 'PUT', url: '/conversations/' + conversation.id + '/assignation', dataType: 'json', data: newAssignation, success: function(data)...

Ember 1.13, view lookup

javascript,ember.js
Prior to ember 1.13 i was using var containerView = Em.View.views[view_id]; to get the ContainerView instance with the view id and manually adding childViews to this container view, which used to work just fine. As of ember 1.13 this view lookup is not supported. What is the recommended way of...

How to get data out of ember objects

javascript,ember.js,kendo-grid
I'm fairly new to ember and I'd like to know whats the fastest way to extract the data out of ember objects. I've loaded my model with a very large amount of records using this.store.find('modelName);` in my route. I created a component on my view using {{kendo-ui.kendo-table descriptor=tableDescriptor data=model}}. My...

How to properly unbind jQuery window event handler in Ember component

jquery,ember.js
I know that the best practice for binding an event handler to a window event with jQuery is jQuery(window).on('resize', Ember.run.bind(this, this.handleResize)); If you try to unbind the event handler though in willDestroyElement with $(window).off('resize', this.handleResize); this doesn't work because .on() and .off() must be called with the exact same reference...

How do I sort a {{#each}} within an ember component

javascript,ember.js
I have a list within a {{#each}} {{/each}}. How would I sort this list in an ember component? components/conversations-list.hbs {{#each model as |conversation|}} {{conversations-item userName=conversation.contact.userName lastConversationTime=conversation.lastConversationTime profilePictureUrl=conversation.contact.profilePictureUrl id=conversation.id}} {{/each}} How would I sort this list by lastConversationTime?...

Exclude folders from builds in Brocfile

javascript,ember.js,ember-cli,broccolijs
Is there a way to exclude a folder from a build in a Brocfile (or any other place). The use case is packaging, where I have an app made of sub-apps within pods. eg. /app/modules/components /app/modules/app1 /app/modules/app2 /app/modules/app3 I'd like to build them all when environment is set to 'development'...

How to get page to update with new records from server without a route change?

ember.js
I have an Ember app that uses server-side storage. In the products route, I have a list of products that I display in my product route (which are fetched in the usual way upon entering the route) {{#each item in sortedProducts}} {{/each}} .... fetch App.ProductRoute = Ember.Route.extend({ model: function(){ return...

Ember, mixin to detect click outside of view/component

ember.js
I'm writing a Mixin to handle when user clicks outside of a view/component. This is the mixin: App.ClickElsewhereMixin = Ember.Mixin.create({ onClickElsewhere: Ember.K, didRender: function() { this._super.apply(this, arguments); return $(document).on('click', this.get('onClickElsewhere')); }, willDestroyElement: function() { this._super.apply(this, arguments); $(document).off('click', this.get('onClickElsewhere')); }, }); I use it in my component: onClickElsewhere: function() { this.send('exitEditMode');...

How to get Ember compoment's “ID” attribute?

jquery-ui,ember.js
I am using a ember components in a recursive manner and im going to make particular components as draggable in jquery-ui. so,i need to get its corresponding view id like "ember143" for the following HTML view, <div id="ember143" class="ember-view"></div> is there a way to get the id attribute? NOTE: i...

Fetching API data from Ember Controller

ember.js,ember-data,ember-cli
I am an Ember newbie and am trying to create a simple application to fetch records from an API server. Currently I am trying to query the this.store.find('validemail',{'email':'abc.gmail.com'}).then(function(response){ console.log(response); }); //Console log on browser Class {query: Object, store: Class, manager: Class, isLoaded: true, meta: Object…}__ember1434866946710: "ember592"__ember_meta__: Object__nextSuper: undefinedcontent: (...)get content:...

Ember belongsTo relationship passing as nil to server on saving

javascript,ruby-on-rails,ruby,ember.js,ember-cli
Ember CLI 0.2.5 + Rails 4.2 using ember-cli-rails gem, active_model_serializer (0.9.3) I am currently trying to pass user into createRecord and it won't save or bind the user_id when passing to rails. Parameters come back as: {"course"=>{"subject"=>"CSE", "number"=>110, "credit_hours"=>3, "grading_scale"=>"Regular", "user_id"=>nil}} Ember Controller (Finding the user returns correct value) import...

Ember select default value

javascript,ember.js,ember-data
I am unable to select a default value in an ember select. Here is what the code looks like Models: rfwa.Field = DS.Model.extend({ Name: DS.attr('string'), FieldTypeId: DS.attr('number'), FieldType: DS.belongsTo('fieldType'), }); rfwa.FieldType = DS.Model.extend({ Name: DS.attr('string') }); Route: rfwa.FieldRoute = Ember.Route.extend({ model: function (params) { var route = this; return Ember.RSVP.hash({...

Zurb Foundation tooltip stays on the screen

ember.js,zurb-foundation-5
zurb foundation tooltip stays on the screen after component removal/insertion: http://emberjs.jsbin.com/jutapilune/2/edit There is a number of hacks floating around, but I wonder - maybe Ember community has resolved that issue already? ...

ember-data stores a string instead of a number

ember.js,ember-data
In my ember app I want to reuse a model attribute as soon as the form is submitted. But the store seems to keep it as string unless I reload the whole route. I am using this and the following components: Ember : 1.12.0 Ember Data : 1.0.0-beta.18 jQuery :...

computed property that changes its value with action in Ember.js

javascript,ember.js,controller
I do have a controller that has an action {{loadRight}} that passes the current model to the controller when I click a button. When I first load the app, I also use firstElement computed property which pulls the first element from my model array. Basically what I want to do...

Does ember-data subsequent find generates XHR every time without caching?

ember.js,ember-data
I have an app built using ember-cli 0.2.5 (which is Ember 1.12.0 and Ember-Data 1.0.0-beta.17). My models' store.find() always generate XHR request to my backend. I would expect subsequent route accesses to use the store's cache. I have two routes, router.js is: Router.map(function() { this.route('rules', {path: '/rules'}); this.route('users', {path: '/users'});...

Reference RSVP hash from inside the same hash

ember.js,hash
I'm trying to load two different models on the same route, I found a stack overflow that explained I can use Ember.RSVP.hash() to get this done, here is what I've done to make it work. model: function(params) { return Ember.RSVP.hash({ flyer: this.store.find('flyer', params.flyer_id), images: this.store.find('image', '-Jrgar1tSArUw-_PiJqX') }); }, As you...

Understanding Ember Routes and Models

ember.js
I try to understand how Ember works and I have an issue I can't understand. I am following a tutorial (guides.emberjs.com/v1.10.0/) and I don't understand why I only see an element when I go on a page when I click (and doesn't work with a direct link). I think some...

Ember.js - Rendering additional data for a model

javascript,ember.js,ember-data
I have an app model and apps have an id and name. this.resource("apps", function() { this.route('show', { path: ':app_id' }); }); I'd like to make the show view show metrics about the app, but the query is pretty intense, so I don't want to include it in the call to...

Sorting data by timestamp on ember

ember.js,ember-data,ember-cli
I've looked at a few examples, but haven't been able to reverse-sort, so that newly generated objects are on top. My sortable items are in components, and I don't think I'm passing sortProperties & sortAscending correctly. lavender.js: export default Ember.Controller.extend({ needs: ['application'], sortProperties: ['timestamp'], sortAscending: false }); lavender.hbs {{#each model.comment...

EmberJS Component With Graph

javascript,jquery,ember.js,highcharts
I have an emberjs component that I was hoping to use to generate Highcharts graphs with. For example, I want to be able to do {{component-name xy_data=data}} and have a graph generate with that data. Currently, my template for the component is simple, it looks like <button {{action "confirm"}}>Click again...

Accessing child functions/properties with arranged content in Ember.js

javascript,ember.js,controller
I'm having some trouble figuring out what to do. Basically I have a 'post' controller that has a function 'imageURL'. This function just takes a string (ex image_1.jpg), and prepends the root path to it (ex images/image_1.png). The problem I'm having is in a parent controller, I only want to...

Emberjs advanced sort hasMany association as a computed property

sorting,ember.js,has-many,computed-properties
I have asked a variant of this question here. But basically I need to create a computed property that operated on a hasMany association. I need to do sorting similar to the javascript sort function; where I can do something like files = ["File 5", "File 1", "File 3", "File...

Execute JQuery code after view has changed

ember.js
I'm using Foundation tooltips on the page with query-parameters - they control what elements are displayed, acts as filter basically. When user change filter and new elements are displayed tooltip stops to work as it needs to be reattached to the new elements - $(document).foundation('tooltip', 'reflow'); so I wonder what...

Ember transitionToRoute cleanly in a component without sendAction

ember.js
How can transitionToRoute be called cleanly from within an Ember component? It works with injecting a controller into the component and calling the controller's transitionToRoute function, however I'd like something a little more elegant if possible. What it currently looks like inside the component's javascript: // this.controller is injected in...

Model from Ember Data not rendering

javascript,ember.js,ember-data
I'm trying to figure out how to fetch data with Ember Data and render. After several problems I got to this point where I get no error on the console but the store is empty after the data is loaded. window.App = Ember.Application.create(); App.IndexRoute = Ember.Route.extend({ model: function(){ return this.store.find('games');...

Creating new array item from input values using Ember.Copy

ember.js
I've just recently started learning something about Ember from the latest Tuts+ tutorial 'EmberJS Framework Basics' (published May 6, 2015). The tutorial uses the 'Ember Starter Kit' as a base and gradually adds more functionality. I'm having a problem with an action "create" within a controller that handles submitted input...

ember build Parse error on line 1: {{#each messages as |message|}}

ember.js,ember-cli
Hi I was attempting to update my ember cli project from ember 1.8.1 -> 1.9.1 & handlebar 1.3.0 -> 2.0.0 however now I get the following error, when I use the command ember build : Build failed. File: ui/templates/components/ember-notify.hbs Parse error on line 1: {{#each messages as |message|}} {{#vie --------------------^...

Display Ember library versions in browser console on app load

ember.js,ember-cli
For some reason, I am having trouble remembering (or finding) how to turn on an option to display versions of ember, jquery, ember-data, etc. in the console automatically. Used to be very handy. I am on Ember-CLI 0.2.7. Ended up doing this in app.js: import config from './config/environment'; if (config.environment...

Ember CLI generated unit test is failing on it exists

javascript,unit-testing,ember.js,ember-cli,ember-qunit
I have an order controller in controllers/order.js import Ember from 'ember'; export default Ember.Controller.extend({ needs: "orders" }); This has a test in /tests/unit/controllers/order-test.js import { moduleFor, test } from 'ember-qunit'; moduleFor('controller:order', { // Specify the other units that are required for this test. // needs: ['controller:foo'] }); // Replace this...

Javascript/Ember Syntax '%@'

javascript,ember.js
Anyone know what this does or what this is? It looks very strange to me. In the context of Ember.js, it is being used in the REST adapter like so: nested/%@/model, almost like a wildcard for the model type maybe? Here is a URL where it is referenced: https://github.com/emberjs/data/issues/775 I...

How to make Ember Cli Mirage to work with Ember Simple auth

javascript,ember.js,oauth-2.0,ember-simple-auth,ember-cli-mirage
For development and testing I want to use Ember CLi Mirage. I'm trying to get it to work with simple auth and oauth2. How do I have to set up Mirage to work with a session token? This is what I'm doing so far: import Ember from 'ember'; export default...

How to not always compile all assets on autoload in ember.js

ember.js,ember-cli,broccolijs
I've started my first ember.js project with ember-cli including ember-cli-broccoli-compass to compile my stylesheets with compass. Now that I've done my first styling, my stylesheets need 5 seconds to compile. When I now work on my javascripts and there are any changes to my files, my whole project, including the...

Setting controller property from inside a component

javascript,ember.js,properties,components
I'm having some trouble getting this to work. I have an image upload component that I want to set a controller property with so that I can later use it in a cropping component that finally will set a property that gets saved to my backend. In index.hbs I render...

Model Property Binding in Ember / Ember-Data

ember.js,ember-data
Is there a recommended approach or pattern to the following application flow? User enters a route Model for route is retrieved and presented to the user via the template. The template inputs are bound to model properties so as the user modifies them, the data in the store is updated...

Running functions on an emberjs component

ember.js
I am wondering what is the best way to control behaviour on a component. In my case I have a {{stop-watch}} component. I want to start, stop and reset the component via the routes using the {{stop-watch}} in their template. The start and reset function should allow me to somehow...

Mapping Ember methods to API

ember.js,ember-data,rails-api
I'm using Ember Data with a Rails API and am wondering how I can map specific actions from Ember to the API. For example, in looking at the Ember docs for deleteRecord and destroyRecord I see no mention of how these methods are translated to the backend. Is this configured...

Inserting external parameter in map function with ember

ember.js,ember-data
I have this function: this.get('model').map(function(item){ if(item.get('isSelected')){ item.set('selectedClass', 'conversation-history'); } }); What I would like to do : this.get('model').map(function(item){ if(item.get('id') == this.get('selectedConvId')){ item.set('selectedClass', 'conversation-history'); } }); This tells me this.get is not a function, and I understand why, I am not in the same scope. But how can I introduce an...

How to set the i18n.locale from within an initializer

ember.js,ember-cli,ember-i18n
I would like to set 'i18n.locale' from within an initializer in EmberJS. I am using 1.12 via Ember-CLI with ember-i18n. I tried this import Ember from 'ember'; export function initialize(container, application) { Ember.set('i18n.locale', 'de'); } export default { name: 'user-locale', initialize: initialize } but am receiving Assertion Failed: Path 'i18n.locale'...

Ember JS - Handlebars template - @index being undefined inside #each

javascript,templates,ember.js,ember-cli,handlebars
I looked for a duplicate question but couldn't find one on SO. Hence here it goes. I have an #each block in my template which is successfully printing the values from an array but when I try to get the current index using @index within that block like this -...

Connect to a RESTful service which ends all URLs with an “/”

ember.js,ember-data
I have to connect to a RESTful service that ends every URL with an "/". The list of products is at http://company.com/api/products/ And the product with the ID 1 is at http://company.com/api/products/1/ This is my current app/adapters/products.js import DS from 'ember-data'; export default DS.RESTAdapter.extend({ host: 'http://company.com', namespace: 'api' }); Is...

What are Element Style Components and What are Fragment Style Components?

javascript,ember.js
I would like to know the difference between Element Style Components and Fragment Style Components ,precisely what is meant by Element Style Components and what is meant by Fragment Style Components? Thanks in advance.

Ember serialize embedded record with custom key

ember.js,ember-data
I've a model with store attribute in it. Unfortunately store is a reserved word in ember-data so I had to change its name to authStore. I can't change backend API to use new attribute name, so I've created a new serializer just for this model. Model is: App.Auth = DS.Model.extend({...

ember nested route not loading

ember.js,ember-data,ember-cli
Just trying to determine how to do this. For an image sharing site I have the following requirement. User is able to view an image User is able to comment on the image User is able to see comments from users friends on the image this is my router.js: this.resource('image',...

Observing RecordArrays in EmberJS

ember.js,ember-data
I have this setup right now: App.Workspace = Em.Object.extend({ users: null, usersChanged: Em.observer('users',function() { console.log('Users Updated!'); }), ... initListeners: function() { var self = this; someObject.on('someEvent', function() { ... console.log('before set'); self.set('users', self.store.all('users')); }); } }); I only get the output "before set", but not "Users updated!" What am I...

Ember i18n dynamic link inside of translation

ember.js,hyperlink,ember-i18n
I was wondering how I could pass a link into to {{t}} helper. I am using v3.0.1 of Ember i18n at the moment. Obviously you cannot pass a link helper into a t helper (something like {{ t "some-translation-string" link={{#link-to 'page' model}}page{{/link-to}} }} won't work of course). So I was...

Can ember-cli watch and build automatically without running the server?

ember.js,ember-cli
Title is pretty much my question. I'm serving the dist directory differently and would still like the benefit of auto-builds but I don't need to run the server. I looked in the docs and the cli help but didn't see anything specific. I know the cli help doesn't contain everything...

Ember Simple Auth - injecting current user into every route

ember.js,dependency-injection,ember-simple-auth
I am building a site using Ember Simple Auth. I followed these instructions to try and add the current user object to the session and it worked, using this slightly adapted code: import Ember from 'ember'; import Session from 'simple-auth/session'; export default { name: "current-user", before: "simple-auth", initialize: function(container) {...

ember 2.0, Cordova and onDeviceReady

cordova,ember.js
The code in app.js looks like this: var App; Ember.MODEL_FACTORY_INJECTIONS = true; App = Ember.Application.extend({ modulePrefix: config.modulePrefix, podModulePrefix: config.podModulePrefix, Resolver: Resolver }); export default App; How do I use deferReadiness and advanceReadiness here ? I need this to call advanceReadiness if the cordova deviceReady event is fired. ...

In EmberJs is it possible to get Class object from an instance of the same Class?

ember.js
Suppose you have var A = Ember.Object.extend({}); A.reopenClass({ myVariable: 'hello' }); var a = A.create(); Is there a way from a to get the A object in order to get the myVariable value ?...

Polymer 1.0 in Ember-cli, wrong appearance

javascript,ember.js,polymer,frontend,ember-cli
I have managed to integrate Polymer 1.0 to my Ember-cli project. This my Brocfile var vulcanize = require('broccoli-vulcanize'); var pickFiles = require('broccoli-static-compiler'); var mergeTrees = require('broccoli-merge-trees'); var EmberApp = require('ember-cli/lib/broccoli/ember-app'); var app = new EmberApp({ compassOptions: { sassDir: "app/styles/main", outputStyle: 'expanded' } }); //app.import("./bower_components/webcomponentsjs/webcomponents-lite.min.js"); var polymerVulcanize = vulcanize('app', { input:...

sortable list in emberjs

ember.js,ember-data,handlebars.js
i have loaded a list from server into handlebar. when the list order changes, i need to send the sorted order back to the server. to make a list sortable, i have used jquery-ui.js. when i change the list order by dragging and dropping the list, visually the list order...

Retrieving model's property in controller

ember.js,ember-data
I have a model which contains a single data but it's inside an array. I want to retrieve this data from inside my controller and making it a property of the controller so I can use it in other controllers. For example : App.CurrentsubuserController = Ember.ArrayController.extend({ currentsubuser: function() { return...

EmberJS - access properties of an object by arbitrary key in a template and have those properties bound using HTMLBars?

javascript,ember.js
With Handlebars I could do this: <script type="text/x-handlebars" data-template-name="index"> <table> {{#each model as |item index|}} <tr {{action 'update' index}}> {{#each col in columns}} <td>{{dd item col}}</td> {{/each}} </tr> {{/each}} </table> </script> App = Ember.Application.create(); App.IndexRoute = Ember.Route.extend({ model: function() { return [ { name: "Joe", description: "Good guy", age: 15...

Handling action parameter within a component in Emberjs

javascript,ember.js,handlebars.js
Why does my <button> work but the {{delete-toggle}} component gives me an undefined for the message variable? {{delete-toggle action='deleteMessage' message=message}} <button {{action 'deleteMessage' message}}>Some Action (param: {{message}}</button> import Ember from 'ember'; export default Ember.Component.extend({ tagName: '', actions: { deleteMessage(message){ console.log(message); return this.sendAction('deleteMessage', message); } } }); ...

Ember passing a model to transitionToRoute

ember.js,ember-cli,ember-router,ember-controllers
I'm using Ember-cli with ember 1.11 I'm trying to use the transitionToRoute method in a controller to transition to a route and feed it a dynamically generated object as the model. Here's my controller: import Ember from 'ember'; export default Ember.Controller.extend({ actions: { launch_scanner: function(){ console.log('launch_scanner'); var model = {name:...

ember-2.0 angle-bracket component not working with [email protected]

ember.js,ember-cli,htmlbars,ember-components
Please what else do I need in order for ember-2.0 angle-bracket component to work with the latest ember-cli I am using ember-cli 0.27, nodejs 0.12.4 and emberjs-canary branch to test out emberjs-2.0. I created a bare bones new ember app with: ember new test-app and created a component with: ember...

What's the best way to map objects into ember model from REST Web API?

json,rest,ember.js,asp.net-web-api,ember-data
The topic of this post is: my solution is too slow for a large query return. I have a Web Api serving REST results like below from a call to localhost:9090/api/invetories?id=1: [ { "inventory_id": "1", "film_id": "1", "store_id": "1", "last_update": "2/15/2006 5:09:17 AM" }, { "inventory_id": "2", "film_id": "1", "store_id":...

In Ember 1.13 and later what key should I use with each when iterating over an array of strings?

ember.js,ember-cli
In Ember 1.13 the following code generates a warning: {{#each widgetNames as |widgetName|}} {{component widgetName removeWidget="removeWidget"}} {{/each}} Where widgetNames is an array of strings in a parent controller. widgetNames: [] In Ember 1.13 I now get this warning: WARNING: Using {{each}} without specifying a key can lead to unusual behavior....

Reloading route after .save()

ember.js,ember-data
I want to reload a route after a .save() (in controller). Currently, ember-data is changing the status in the store but whatever I tried for reloading the route didn't work. The problem is I want to reload the current route based on conversation status. For example, if I'm currently in...

How to run action in Ember Controller afterRender

ember.js,ember-data,ember-cli
im new to ember framework. I just want to execute a function that defined inside the actions hook when the rendering completes. var Controller = Ember.Controller.extend({ actions: { foo: function() { console.log("foo"); } } }); Ember.run.schedule("afterRender",this,function() { this.send("foo"); } but the above code not working. I just want to know...

Handlebars template won't render ember data object

ruby-on-rails,ember.js,handlebars
I've built an ember front-end app that consumes an API made with rails in another application. The ember app is successfully requesting and receiving data from the rails api and one of my handlebars template (the index page that displays a list of all of the Graduates from my Graduates...

Ember: Merge Multiple Column of Arrays to rows

javascript,arrays,ember.js,ember-data
I have to populate a grid in which each column's data comes as a array under the object as mentioned below where A and B are column names and data structure as follows { A:[1,2,3], B:[4,5,6] } So to render this as a table in template it will be easier...

When creating a new data object in Ember that relies on another object how do you pass it along?

ember.js,ember-cli
I am on a page where I can see a specific customer, part of my router.js is: this.route('customers'); this.route('customer', {path: "customers/:customer_id"}); this.route('customer.order.create', { path: "customers/:customer_id/order/create" }); customer.order.create needs to load in my main view and so is not nested. An order 'has a' customer. I've setup my /customer/order/create controller to...

ember model rendering strange behaviuor

ember.js
While experimenting with ember and ember-localforage-adapter I noticed a strange behaviour. ember.debug.js:4888DEBUG: Ember : 1.12.0 ember.debug.js:4888DEBUG: Ember Data : 1.0.0-beta.18 ember.debug.js:4888DEBUG: jQuery : 1.11.3 I have three models: /app/models/ledger.js import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr('string'), purchases: DS.hasMany('purchase', {async: true}), players: DS.hasMany('player', {async: true}), }); /app/models/purchase.js import DS...

Ember: How to get computed properties from a nested model?

ember.js,ember-cli,rsvp-promise
First: I have no idea how to work with promises in Ember.js. I want to call a property of my controller which depends on async model-data which is also nested. Also, my model looks something like that: +-------------+         +------------+ | Method      | hasMany |  Practice  | |             +--------->            | |             |         |            |...

Access Properties of JS Object on Controller

ember.js,handlebars.js,javascript-objects
I have created an Ember.JS application where I hang some properties on the ApplicationController that need to be accessible form all over the app. One of these properties is queue (a JS object) broken down by server names (JS arrays). In my template I would like to list the items...

Ember navigates to a show route, GETs the wrong URL (/tools instead of /tools/1)

ember.js,ember-data
I have a conventional Ember CLI app, and a conventional show route: export default Ember.Route.extend({ model: function(params) { return this.store.find('tool', params.tool_id); } }); But when I navigate to /tools/1, it GETs /tools instead of /tools/1! What am I doing wrong? Extra info... I'm using the --proxy http://127.0.0.1:3000 option to pass...

How do I communicate the form parameters from the template to the route in ember.js?

forms,ember.js
I have a form like this in a template: <form {{action 'add' on='submit'}}> <label for="name">Name</label> {{input value=name placeholder='Enter name' required="required"}} </form> Then I have the following route: import Ember from 'ember'; export default Ember.Route.extend({ actions: { add: function() { alert(this.get('name')); } } }); The alert is fired, but the output...

Ember.js: select state not saved in URL when reload page

select,ember.js,ember-data
There are select on the page for choosing country and it's need to save selected value in URL. I declared query params in route-driven controllers. It's all work! If country select is changed then url also changed. Demo: http://output.jsbin.com/releza But if I reload page with some valid GET params then...

Ember Data TypeForRoot no longer being called

ember.js,ember-data
We are currently on Ember Data 1.0.0-beta.18, Ember 1.12 and CLI 0.2.7. Since this last update, we are getting ember data assertion warnings like the following: [Warning] WARNING: Encountered "open_requests" in payload, but no model was found for model name "open-request" (resolved model name using [email protected]:appuser:.typeForRoot("open_requests")) (vendor.js, line 15423) I...