ember.js

In an Ember view, what's the best way to run code after the rerendering of an internal child view?

折月煮酒 提交于 2019-12-24 01:27:37
问题 I found a lot of questions about how to initialize jQuery plugins with dynamic data etc and usually the answer is that you should use the didInsertElement hook. My problem is that when using ember-data, initially the view is inserted empty and the template vars are filled afterwards through the bindings. Thus in didInsertElement the elements I need are not there. I found a solution that works for me but I think there must be a better solution. In addition to the didInsertElement method I also

Emberjs, Target a model without leaving '/models' url

走远了吗. 提交于 2019-12-24 01:11:13
问题 I have a table of models and I want to be able to click my {{action 'edit'}} in one of those model's and ember will know which model # the {{action 'edit'}} is in. Right now I am receiving this error: 'GET localhost:3000/category/undefined 404 (Not Found) ' Here is my code in the '/categories' route. <tbody> {{#each}} <tr class="people-list"> <td> <input type="checkbox" class="toggle"> {{#if isEdit}} {{view Ember.TextField valueBinding="Name" name="Name"}} {{else}} <label class="category-text

Capturing failed request with ember-simple-auth

元气小坏坏 提交于 2019-12-24 01:01:46
问题 I am adding functionality to allow users to reject un-expired oauth tokens. (I am using ember-simple-auth-oauth2 and a custom oauth2 implimentation). I would like to notify clients using a rejected token that their token was manually rejected. The 401 response from the server contains the reason the token is no longer valid ({message: "Token was expired by ip 1.1.1.1"}). None of the invalidationSucceeded callbacks or events in the session or application mixin seem to have the 401 request

Are Recursive Collections possible in sproutcore2?

☆樱花仙子☆ 提交于 2019-12-24 00:57:02
问题 I have a customizable navigation tree that can be nested 3 levels deep. Templates: <script type="text/x-handlebars" data-template-name="NavItemView"> <a {{bindAttr href="href" class="content.className"}}>{{content.name}}</a> {{##if content.children}} another collection here? {{/if}} </script> <script type="text/x-handlebars"> {{collection App.NavItemsCollectionView contentBinding="App.navItemsController" tagName="ul"}} {{view App.CreateLinkView id="new-link" placeholder="Name"}} </script>

Dependable views in Ember

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 00:55:30
问题 I have an app which lists albums. When album is clicked on both AlbumView and App.overlay (also a view) are displayed. App.overlay = Ember.View.create({...}) (Lightbox-like overlay). and: App.AlbumView = Ember.View.extend({ // close the selected album view by closing the overlay close: function() { App.overlay.close(); } }); And here's the problem: I want to be able to close those both views by clicking on the overlay, but I want overlay to remain independent of AlbumView , so that I can use

Injecting service into a mixin Ember2.3+

*爱你&永不变心* 提交于 2019-12-24 00:46:31
问题 I am having a problem with an error that pops up in my unit test suite when I try to check a service injected into Mixin since getOwner() has been added into Ember (deprecation guide here). This is my mixin: import Ember from 'ember'; export default Ember.Mixin.create({ sha: Ember.inject.service('sha512'), }); This is my basic unit test slightly changed after being generated by ember-cli: import Ember from 'ember'; import DirtyRelationshipsDetectorMixin from 'xamoom-customer/mixins/dirty

how to deal with custom events in ember.js component?

爱⌒轻易说出口 提交于 2019-12-24 00:37:56
问题 I'm new to Ember.js and I've got some problems to understand its philosophy. I know actions up, data down but in real life, lets say I have Fotorama initialized in my-gallery component (I don't know if that is ok, but I did it in didInsertElement method). This library has its own events. They could look like this in plain JS: $('.fotorama').on('fotorama:ready', function (e, fotorama) {}); or: $('.fotorama').on('fotorama:show', function () {}); but I feel in Ember, those should be somehow

Ember source code hosting URL for handlebars?

主宰稳场 提交于 2019-12-24 00:36:46
问题 I know that http://builds.emberjs.com/ has Ember Latest Stable Ember Data Latest But where can I find the latest compatible handlebars source URL? http://emberjs.com.s3.amazonaws.com/getting-started/handlebars.js is version 2 but the latest Ember requires version 3. 回答1: You were almost there. You can find the latest compatible handlebars.js directly here: http://builds.emberjs.com/handlebars-1.0.0.js So this leaves you with: http://builds.emberjs.com/handlebars-1.0.0.js http://builds.emberjs

Ember-data bootstrapping model objects

假装没事ソ 提交于 2019-12-24 00:27:08
问题 When bootstrapping Ember-data model objects with existing JSON that is not from a remote AJAX call, do I have to make the following 2 calls: App.store.load(App.Account, data); var account = App.store.find(App.Account, data.id); Is it not possible to create the Object in one step, similar to calling setProperties on an existing Ember object? Also, how would this work for creating a collection of Ember model objects? For example: var users = App.get('users'); App.store.loadMany(App.User, users)

Ember.js model to be organised as a tree structure

末鹿安然 提交于 2019-12-24 00:24:48
问题 I am learning Ember.js, using a Rails backend. I'm looking to set up a tree structure for relating a Group model to itself (Sub-Groups). Since it's pretty mature, I'd like to link up the Ancestry gem for consumption on the Ember side. Ancestry adds a string column called "ancestry" to my Group model, and returns a string of parent ids. How would one approach the setting up Ember models in this case? 回答1: I figured it out with some tinkering around with the group serializer and Ember model. #