ember.js

Bootstrap 3 modal pattern with Ember.js

夙愿已清 提交于 2020-01-03 02:36:10
问题 Here is what I'm trying to base my code on (based on Bootstrap ~2): http://jsfiddle.net/marciojunior/tK3rX/ <script type="text/x-handlebars" data-template-name="application"> <h1>Boostrap modal sample</h1> <a {{action showModal}} href="#">Open modal</a> </script> <script type="text/x-handlebars" data-template-name="modal"> <!-- Modal --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class=

Material design lite inputs in Ember.js app loses it design after route transition

*爱你&永不变心* 提交于 2020-01-03 02:01:05
问题 I am trying to use Material design lite with an Ember.js application and got the form working somehow. However, when the user navigates from one page to another page containing the form or inputs, the inputs do not seem to behave as expected. For an example here, when the page loads first time to home page, input works fine but when we switch between sign-in and home pages, inputs fallbacks to basic form and material design animation is lost. Not sure if this issue is related to Ember.js or

Deleting hasMany record and saving with ember-data

依然范特西╮ 提交于 2020-01-02 23:09:32
问题 I have a jsbin setup with my issue: http://emberjs.jsbin.com/sovub/3/edit From my example, in certain situations when I try to delete a subtitle and then save, I get the error: Attempted to handle event `pushedData` on <App.Subtitle:ember563:7> while in state root.deleted.uncommitted. If I delete the last subtitle then save, it's fine. But deleting the first subtitle, or deleting and adding new records then saving gives me the error message. Is it because I'm manually setting the IDs for each

Filtering store data in ember

℡╲_俬逩灬. 提交于 2020-01-02 20:00:57
问题 I am trying to filter some hard coded data in an Ember route which is being provided by mirage and having trouble. Either Ember moans at my syntax (when trying to use filter on the store) or it doesn't return any data when I use findAll and then use the JS filter method on the objects. Attempt 1 - Using findAll(): Route export default Ember.Route.extend({ model() { return { txSites: this.get('store').findAll('site').filter((site) => { return site.siteType === 'tx'; }) }; } }); Template

How to save models with many-to-many relationship in Ember.js?

Deadly 提交于 2020-01-02 14:32:53
问题 I'm stuck with this problem for so long that I think that I'm missing something obvious. Here's simplified model of my case: There is Patient that has all meds that he/she takes. And there is Medicine that has all patients who takes it. // Patient model Yo.Patient = DS.Model.extend({ firstName: DS.attr('string'), lastName: DS.attr('string'), meds: DS.hasMany('medicine') }); // Medicine model Yo.Medicine = DS.Model.extend({ title: DS.attr('string'), patients: DS.hasMany('patient') }); I've

Ember JS, Error while parsing Data in Transformer handeling event `didCommit` in state root.loaded.updated.uncommitted."

痞子三分冷 提交于 2020-01-02 08:31:13
问题 I am getting an error in an Ember Transformer trying a parse a date in the serialize function. Error message: "Attempted to handle event didCommit on <(subclass of DS.Model):ember1597:8260357> while in state root.loaded.updated.uncommitted." Strangely enough, the data is transmitted correctly parsed to the server. Code: DS.Transform.extend({ deserialize : function(serialized) { var array = []; if (Ember.isArray(serialized)) { serialized.forEach(function(item) { if (item.feldTyp === "DATE

Ember: error.messages does not show server errors on save

假装没事ソ 提交于 2020-01-02 07:27:28
问题 When trying to create a new record, the errors.messages do not render as described in the docs. That said, the console does render the error Error: The backend rejected the commit because it was invalid: {email: has already been taken} . I have the following in my ember-cli app: Router Router.map -> this.route 'users/new', path: '/signup' Route UsersNewRoute = Ember.Route.extend( model: -> return @store.createRecord('user') ) Controller UsersNewController = Ember.ObjectController.extend(

Ember-Router: How to add a route in run-time in Ember 1.0-rc2?

删除回忆录丶 提交于 2020-01-02 04:45:50
问题 In the new Ember.Router that shipts with Ember 1.0-rc2, is it possible add route in run-time? 回答1: There is not a supported method of doing this currently. The App.Router.map call is handled by lines 235-247 of this code: https://github.com/emberjs/ember.js/blob/master/packages/ember-routing/lib/system/router.js Ember.Router.reopenClass({ map: function(callback) { var router = this.router = new Router(); var dsl = Ember.RouterDSL.map(function() { this.resource('application', { path: "/" },

How to re-render application template with new router?

让人想犯罪 __ 提交于 2020-01-02 04:42:27
问题 The code I'm using the version 4fcdbf2560 with the new router. In my application, a user can be authenticated or not. The rendered template will not be the same depending on the authentication state. I've manage this by redefining the function renderTemplate in the ApplicationRoute : App.ApplicationRoute = Ember.Route.extend({ renderTemplate: function() { this.render(App.authenticated() ? 'authenticated' : 'unauthenticated'); } }); My router is quite simple: App.Router.map(function(match) {

What is difference between two way data binding and reactivity?

ⅰ亾dé卋堺 提交于 2020-01-02 04:30:18
问题 As i follow some tuts for angular and ember.js I came across the term Two way data binding. Where data displayed on UI are bind with database and any changes to one is quickly propagated to the other. When I started learning meteor.js i came across term "Reactivity" which for me makes same sense as two way data binding. Can you please tell me fundamental difference between these two terms? 回答1: Reactivity is in fact more general than data binding. With reactivity you can implement data