ember.js

Ember-cli, Masonry, Isotope, Packery. How to use?

删除回忆录丶 提交于 2019-12-13 06:30:46
问题 I need to use them in my ember-cli project. How to start? I writed in terminal: bower install isotope --save then in my ember-cli-build.js I added app.import ecc... , but then I don't know what to do. Where to put my intialization script, like this: $('.grid').isotope({ // options itemSelector: '.grid-item', layoutMode: 'fitRows' }); If I put it in application.hbs it give to me an error and when i change route with {{#link-to}} it doesn't work anymore. What to do? In the web there aren't many

YUI with emberjs Datatable with ember dynamic link

穿精又带淫゛_ 提交于 2019-12-13 06:27:18
问题 I recently discover YUI, and I wanted to use it with my ember app. I wanted to generate a dynamic link from ember but inside a datatable widget of YUI. I want to add a new column name "detail" and put the link of every enquriry in it< I have this so far : App.Enquiries.reopenClass({ data: null, findAll: function() { var result = []; $.ajax({ url: host + 'mdf/enquiry', type: 'GET', accepts: 'application/json', success: function(data) { data.enquiries.forEach(function(enquiry){ var model= App

emberjs display an object return from an ajax call

隐身守侯 提交于 2019-12-13 06:22:42
问题 I have a small problem with my ember app, but I still don't know how to solve it.. I have this error : Error while loading route: TypeError: Object #<Object> has no method 'addArrayObserver' With this code : <script type="text/x-handlebars" data-template-name="enquiry"> {{#link-to 'enquiries' class="create-btn"}}Back to the enquiries{{/link-to}} <div class="enquiry-info"> <button {{action "update"}}>Update</button> <table> <tr> <td>{{enquiry.customerName}}</td> </tr> <tr> <td>{{customerEmail}

Ember - computed sort

我怕爱的太早我们不能终老 提交于 2019-12-13 06:21:46
问题 I am using the below code for sorting a list. sortOptions: ['amount:desc','place'] Ember.computed.sort('model',sortOptions) The key "amount" is basically a number, but in JSON "model", its coming as a string. So, when I ran this code, it wasn't sorting by amount, but when I modified the JSON to convert that amount string to amount number, that worked. Is this correct behavior of Ember computed sort? 回答1: you can use custom function with the Ember.computed.sort which can solve your problem I

Call one controller from another without reloading it

让人想犯罪 __ 提交于 2019-12-13 06:14:12
问题 I need to call one controller from another. export default Ember.Controller.extend({ needs : ['another'], .... callAnother: function() { this.get('controllers.another').reloadIt(); } }) Another controller: export default Ember.Controller.extend({ init: function() { calling API }, reloadIt: function() { calling API } }) When I call this.get('controllers.another').reloadIt() . It calls init and reloadIt . Is it possible to call it without init because it's already loaded. Thanks. 回答1: Please

ember.js multimodel forms: what is expected from ember-data?

徘徊边缘 提交于 2019-12-13 06:13:48
问题 I have classic multimodel form: a transport document that has many transport_document_rows, as stated in my MODELS: App.TransportDocument = DS.Model.extend number: DS.attr 'string' date: DS.attr 'string' transportDocumentRows: DS.hasMany('App.TransportDocumentRow') App.TransportDocumentRow = DS.Model.extend productName: DS.attr 'string' quantity: DS.attr 'string' transportDocument: DS.belongsTo('App.TransportDocument') I write in console this script: a = App.Invoice.createRecord(); a.get(

Ember Route Promise - Is this doing what I need?

心已入冬 提交于 2019-12-13 06:07:09
问题 I have a route that returns 3 models. Each model needs to be resolved before the route returns the models. I've attempted this using the following pattern (some code redacted to aid clarity) export default Ember.Route.extend({ model: function(params, transition) { var _this = this; //Set up a hash to pass to RSVP. Ensures that permissions are returned BEFORE outlet and account query var getPermissions = { permission : this.store.query('permission',query).then(function(permissions){ var

Ember Cli 0.2.7 initializers Loader Uncaught Error: Could not find module

余生颓废 提交于 2019-12-13 05:59:50
问题 Hi I have recently upgraded to the latest version of Ember-Cli and encountered an issue where if I attempt to load the page (by going to the url after typing the command ember server ) it doesnt load the page an give the error: Uncaught Error: Could not find module torii/redirect-handler imported from ui/initializers/initialize-torii-callback If I remove the tori configuration from the environment.js. This error does not occur. Has somethings changed in ember cli where i must explicitly

ember data array UI not updating on pushObject

有些话、适合烂在心里 提交于 2019-12-13 05:59:06
问题 I have a list of product-tag that I fetch for my model. Route: model: function() { return { product_tags: this.store.find('product-tag', {merchant: merchId}) } } I have a component that adds tags to the model, however when after I create the record and push it into the model (as suggested on other posts) my UI still isn't updating. addTag: function(name) { tag = this.store.createRecord('product-tag', { name: name }); this.model.product_tags.toArray().addObject(tag); tag.save(); } //model

How to use custom test helper in ember.js

谁说胖子不能爱 提交于 2019-12-13 05:55:09
问题 I generated a custom test helper with: ember generate test-helper integration-for Here it is with its code removed: // tests/helpers/integration-for.js import Ember from 'ember'; export default Ember.Test.registerHelper('integrationFor', function(app, key) { return key; }); I can't get it to actually work in a component-test though. I've tried using it directly: // tests/integration/pods/components/itegration-item/component-test.js import { moduleForComponent, test } from 'ember-qunit';