ember.js

Adding a function call on the end of function in coffeescript

牧云@^-^@ 提交于 2020-01-13 19:00:55
问题 Any ideas on how to write this as coffeescript? Person = Ember.Object.extend({ // these will be supplied by `create` firstName: null, lastName: null, fullName: function() { var firstName = this.get('firstName'); var lastName = this.get('lastName'); return firstName + ' ' + lastName; }.property('firstName', 'lastName') }); I'm particularly interested in the }.property part of the code. I can't figure out how to write this in coffeescript. 回答1: personally, i like braces around my functions:

Ember Data only populating the “id” property

删除回忆录丶 提交于 2020-01-13 18:13:08
问题 Problem: The JSON is received from the server, but only the id property have a value. The GUI only displays the String "2 1", and the {{photoName}} is ignored. Manually calling MyApp.PhotoController.get('content').objectAt(0).get('photoName') returns undefined , whereas MyApp.PhotoController.get('content').objectAt(0).get('id') returns the correct ID. Any Sugggestions ? //My Model: MyApp.Photo = DS.Model.extend({ id: DS.attr('number'), photoName: DS.attr('string'), photoDescription: DS.attr(

Integrating Ember with Express JS

时光毁灭记忆、已成空白 提交于 2020-01-13 17:48:07
问题 I am aiming to build a project using the Express.Js engine and ember.js for the MVC structure. I would like to know if anyone has any tips, or links to resources that can help me with setting up the file structure and how to integrate routing with the MVC. 回答1: We are using ember/express/node backed by riak, and in our solution the ember.js app will be talking to the express REST server. We're using this: https://github.com/nathanaschbacher/chinood Basically the ember app downloads once and

What ember.js component is responsible for inserting templates into the DOM?

我怕爱的太早我们不能终老 提交于 2020-01-13 13:52:26
问题 I am building an ember.js/rails application. All the handlebar templates are stored in .js files. I'd like to understand how they get inserted into the DOM when the router changes state. Which part of ember does this? How do I tell ember to place templates? Right now I can only get my templates appended to the <body> I have a jsFiddle here. I am aware of setting rootElement on Ember.Application, however I want the app to control other elements of the page. Handlebars / HTML : <script type=

Does Ember support localization like SC 1.x

北慕城南 提交于 2020-01-13 13:06:11
问题 We were able to easily localize SC app with the strings table and sc-build did a good job of building out the different lang directories with the right localized files. Does Ember provide these? thx 回答1: Not exactly the same as SC 1.x, but yes there is localization in Ember. You'll first need to define your localized strings to Ember.STRINGS: Ember.STRINGS = { '_save': 'Save', '_ok': 'OK', '_apply': 'Apply', '_cancel': 'Cancel', '_close': 'Close', '_refresh': 'Refresh' } Then you can localize

Does Ember support localization like SC 1.x

自古美人都是妖i 提交于 2020-01-13 13:05:04
问题 We were able to easily localize SC app with the strings table and sc-build did a good job of building out the different lang directories with the right localized files. Does Ember provide these? thx 回答1: Not exactly the same as SC 1.x, but yes there is localization in Ember. You'll first need to define your localized strings to Ember.STRINGS: Ember.STRINGS = { '_save': 'Save', '_ok': 'OK', '_apply': 'Apply', '_cancel': 'Cancel', '_close': 'Close', '_refresh': 'Refresh' } Then you can localize

Observe properties on nested object

时间秒杀一切 提交于 2020-01-13 10:39:27
问题 Example fiddle: http://emberjs.jsbin.com/aviyUnA/9/edit?html,js,output This is my model: { name: { title: 'Mr', first: 'Potato', last: 'Head' }, age: 79 } How do I create a computed property that observes all the keys inside the name object without listing them manually? fullName: function() { var name = this.get('name'); return [name.title, name.first, name.last].join(' '); }.property('name.??') Thanks for any help! 回答1: You can customize the set call of your model: Check if the value being

Access the new ember router in the console

喜夏-厌秋 提交于 2020-01-13 09:08:29
问题 Is there an equivalent function to grab the currentPath in the console with the new router in ember? Before, I was able to do this: App.router.get("currentPath") However, it seems with the new router, you can't access the router in the same fashion. In fact App.router simply returns undefined. Any help here would be greatly appreciated. edit: On a related note, because I can no longer access App.router and its properties, I can't figure out how to manually trigger state changes. For example,

ember testing Error Adapter operation failed

元气小坏坏 提交于 2020-01-13 07:06:49
问题 My test is pretty simple. It was working before but now I have facing a new issue I am getting failure message Adapter operation failed at http://localhost:4200/assets/test-support.js:4578:13 at exports.default._emberTestingAdaptersAdapter.default.extend.exception (http://localhost:4200/assets/vendor.js:52460:34) at onerrorDefault (http://localhost:4200/assets/vendor.js:43162:24) at Object.exports.default.trigger (http://localhost:4200/assets/vendor.js:67346:11) at Promise._onerror (http:/

how to communicate with Rails in Ember

假如想象 提交于 2020-01-13 06:50:10
问题 Let me explain shortly what I mean. I'm writing an app that makes use of Ember and Rails. Every employee can give other co-workers a kudo. He can't know how many others received. I can only know how many left kudos I have to give and how many I received from others. But I can't really understand how to communicate with Rails. As a picture is worth a thousand words, please take a look at this: kudos app http://wstaw.org/m/2013/03/25/kudos.png When the app starts I load a list of users pointing