ember.js

Ember Link To Next Object In Model

荒凉一梦 提交于 2019-12-24 08:49:45
问题 http://emberjs.jsbin.com/aGUguJA/10 Using the bloggr example I built a list of posts and a post view and I've added 2 actions to the post template, Previous and Next. App.PostController = Ember.ObjectController.extend({ actions:{ next: function(){ //Go to next object in a model }, prev: function(){ //Go to previous object in a model }} }); I can't figure out how to make the Previous and Next to work. I have a strong feeling I need to be using an ArrayController but I still wouldn't know where

Place to put assets for dev/test in emberjs

霸气de小男生 提交于 2019-12-24 08:25:42
问题 I'm using mirage to mock some data and I'd like to mock an <img> with the appropriate file. The problem is that I will have to place the image in /public/assets and the images placed there will be deployed later on as well. Is there a way to avoid this? I couldn't find a recommendation in the ember cli website (https://ember-cli.com/user-guide/#asset-compilation) I found one addon that could do this (ember-test-assets), but I'd like to avoid installing extra addons as much as possible. Thanks

Mitigating a flickering UI when refreshing content in Ember

百般思念 提交于 2019-12-24 08:13:34
问题 The problem I have a view which displays a list of workers. This view has a button which calls a controller method named refresh . Originally I was setting the content to this list, but noticed that the UI would flicker, which would be especially annoying once this is run on a timer. I managed to make everything work without flickering using the following: App.WorkersIndexController = Ember.ArrayController.extend refresh: -> console.log 'refreshing workers' # set a property to a new

After update ember-cli 2.11.0 version how to npm instead of bower?

点点圈 提交于 2019-12-24 08:09:06
问题 When I updated ember-cli to 2.11.0 and I found EMBER NO LONGER SUPPLIED VIA bower . So I check npm instead of bower, but I don't know what to do. Such as moment.js use bower look like: bower.json "dependencies": { ... "moment": "2.14.1" } ember-cli-build.js ... app.import('bower_components/moment/moment.js'); ... .jshintrc ... "moment": true, ... This way can run in help and controller . But I use npm and set ember-cli-build.js code app.import('node_modules/moment/moment.js'); had errors. And

What is the best practice to implement custom Javascript code and where should I start working with Ember first?

拜拜、爱过 提交于 2019-12-24 08:05:28
问题 I'm using Ember 2.7.0 of course with ember-cli. I come from Rails, I used to put in "assets/application.js" all my javascript like, for example: var ready = function () { myFunction('test'); $('#btn-fluid').on('click', function () { $('#myPage').toggleClass('container') }); } document.addEventListener("turbolinks:load", function () { ready() }) Now with Ember where I have to put this code in my application? I read on the web the use of: Ember.Application.create({ ready: function () { }); but

Native Array in Emberjs does not support deep copy?

▼魔方 西西 提交于 2019-12-24 07:48:34
问题 Native Array in Emberjs does not support deep copy? I saw it just returning sliced array in the copy method. Is it a bug? 回答1: Currently, that's an improvement going on Ember, reported by @adamjmurray: https://github.com/emberjs/ember.js/issues/588 There's also a proposition to implement it. You can use it like this: var NativeArray = Ember.Mixin.create(Ember.NativeArray, { copy: function(deep) { if (deep) { return this.map(function(item){ return Ember.copy(item, true) }); } else { return

Right way to make AJAX GET and POST calls in EmberJS

妖精的绣舞 提交于 2019-12-24 07:10:03
问题 I've started working on EmberJS and I absolutely love it. It does have a learning curve but I believe it has fundamentally very meaningful principles. My questions is how to make GET and POST calls in Ember JS. I understand that there are models / store, but models (in my opinion) would be to only a particular entity's attributes. Any thoughts on the following questions would be great. 1. USER A send friend request to USER B. Should there be a "Request" model? And do I just make a POST

Ember.js routing and jQuery UI Draggable mixin messing with each-other

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 07:09:29
问题 I have been banging my head against this for 2 days solid now and I need some advice on how to track down the root of this problem. Hopefully someone (you, reading this perhaps?) has had a problem similar enough that you can offer some help. My app has a few things draggable via the jQuery UI widget with that name. This works really well until I navigate inside the app using Ember's routing. Something happens when the UI is refreshed and the things in and around the draggable items are re

Use Material Design Components with ember-cli-sass

拥有回忆 提交于 2019-12-24 07:06:53
问题 I'm trying to use Material Components Web(MDC-Web) sass functionality with ember-cli-sass. I've installed MDC-Web with Yarn In my ember-cli-build.js file I've set my sass includePaths as so: sassOptions: { includePaths: ['node_modules/material-components-web','node_modules/@material'] } and then in my app.scss file attempted to import the full component library like so: @import "material-components-web"; However I'm getting the error: Error: Error: File to import not found or unreadable:

Ember ArrayController cannot be sorted by property defined in itemController

老子叫甜甜 提交于 2019-12-24 07:01:51
问题 I want to sort an ArrayController by a property defined/computed in the itemController. See this JSBin. If you sort by firstName (defined in the model), it works fine, but if you sort by lastName (defined in the itemController), it doesn't work. Make sure to play with sortAscending: true or false. Any idea how to make this work? Here is another simpler JSBin that exhibits the same behavior (the first JSBin is closer to my actual code). 回答1: The sortable mixin is applied on the content, not on