ember.js

Execute code once after all views have completely rendered in Ember.js

自闭症网瘾萝莉.ら 提交于 2019-12-30 06:20:09
问题 Something like document ready, but after all Ember views rendering I am doing this right now with an override on ApplicationView didInsertElement, which seems to be working so far: App.ApplicationView = Em.View.extend({ didInsertElement: function() { // Do your magic. } }); I am wondering if this is the right way for an Ember document ready, or if Ember has a more native support for this simple and very common thing. 回答1: You can easily add a "post render" hook by reopening the base View

How to make jQuery Mobile stop breaking Ember.js site?

为君一笑 提交于 2019-12-30 05:25:27
问题 I have a website written with Ember.js. Navigation is based on urls with # sign. I've included jQuery Mobile. I have also jQuery standard. jQuery was ok, but when i included jQuery Mobile strange things happen. The # sign is removed from URLs and my h1 tag is replaced with text "loading". How to make jQuery Mobile act nicely with Ember.js site? Update: I've created a demo showing the issue described. Ember.js alone Here: http://quizz.pl/ffs/without-jquerymobile You have a demo page using

Ember CLI / browser refresh / production / 404

守給你的承諾、 提交于 2019-12-30 04:36:07
问题 I developed my webapp using Ember CLI 0.1.15, with emberjs. 1.8.1 I built the app with this command: ember build --environment production , and then I made a WAR out of the files produced under the dist folder of my project, and then I drop the WAR on my tomcat's webapps folder. So, when I open the app: http://mytomcat/myapp/ ... it went fine, I saw my login screen, I logged in, and navigate around in my app, everythings fine. I could also do the back/forward button, and ember handles the

How to call an action on a route using closure actions?

折月煮酒 提交于 2019-12-30 03:44:06
问题 I've got openModal action defined on application route. I'm trying to call this action from within a component. If I use syntax for action bubbling: {{my-component openModal="openModal"}} then everything works as expected and I can trigger this action using this.sendAction("openModal") . However, I'm not sure how to get the same result using the new closure syntax: {{my-component openModal=(action "openModal")}} In this case, Ember complains that there's no action openModal defined on the

Ember.js - CRUD scenarios - Specifying View from within a Route

こ雲淡風輕ζ 提交于 2019-12-30 03:21:53
问题 I've asked a question previously in which I wanted to bind a collection residing in the controller to the list scenario view, however, I've added details and edit templates and views to my structure producing a couple of extra sub-routes: root.contacts.details -> /contacts/:contact_id root.contacts.edit -> /contacts/:contact_id/edit In my details scenarios I first started calling the connectOutlets as follows [...] connectOutlets: function (router, contact) { router.get('contactController')

Show property which includes html tags

*爱你&永不变心* 提交于 2019-12-30 01:34:05
问题 I've an ember property which includes html tags ( <br /> , <strong> , <p> , <span> , and similar stuff). How can i tell ember not to escape this text? Is there any default Handlebars helper from ember, or need I to write my own? 回答1: From http://handlebarsjs.com/ Handlebars HTML-escapes values returned by a {{expression}} . If you don't want Handlebars to escape a value, use the "triple-stash". {{{expression}}} 回答2: Within Ember.js you can do this via the htmlSafe method, which is added to

Ember Data: Saving relationships

独自空忆成欢 提交于 2019-12-30 00:35:28
问题 I need to save a deep object to the server all at once and haven't been able to find any examples online that use the latest ember data (1.0.0-beta.4). For example, with these models: (jsfiddle) App.Child = DS.Model.extend({ name: DS.attr('string'), age: DS.attr('number'), toys: DS.hasMany('toy', {async:true, embedded:'always'}), }); App.Toy = DS.Model.extend({ name: DS.attr('string'), child: DS.belongsTo('child') }); And this code: actions: { save: function(){ var store = this.get('store'),

Ember Data - Saving record loses has many relationships

冷暖自知 提交于 2019-12-30 00:35:26
问题 I am having an issue working with Ember Data Fixture Adapter. When saving a record, all of the record's hasMany associations are lost. I have created a simple JS Bin to illustrate the issue: http://jsbin.com/aqiHUc/42/edit If you edit any of the users and save, all the projects disappear. This is using Ember 1.0.0 and the latest canary build of Ember Data. I am not sure if I am doing something wrong or if this is an issue with Ember Data. Thanks 回答1: To answer my question, the DS

Ember Data - Saving record loses has many relationships

眉间皱痕 提交于 2019-12-30 00:35:18
问题 I am having an issue working with Ember Data Fixture Adapter. When saving a record, all of the record's hasMany associations are lost. I have created a simple JS Bin to illustrate the issue: http://jsbin.com/aqiHUc/42/edit If you edit any of the users and save, all the projects disappear. This is using Ember 1.0.0 and the latest canary build of Ember Data. I am not sure if I am doing something wrong or if this is an issue with Ember Data. Thanks 回答1: To answer my question, the DS

How to architect an Ember.js application

两盒软妹~` 提交于 2019-12-29 10:06:14
问题 It's been difficult to keep up with the evolution of Ember JS as its approached (and reached!) version 1.0.0. Tutorials and documentation have come and gone, leading to a lot of confusion about best practices and the intent of the original developers. My question is exactly that: What are the best practices for Ember JS? Are there any updated tutorials or working samples showing how Ember JS is intended to be used? Code samples would be great! Thanks to everyone, especially the Ember JS devs!