ember.js

How to use Ember Data with Nested Resources

我的未来我决定 提交于 2019-12-19 17:31:46
问题 My application backend has several resources. A model is exposed for each resource. The entry point to all other resources is through the User model. What I mean is, given a User we can find BlogPost . Given a BlogPost we can find Comments etc. In Ember terminology, we could say: User hasMany BlogPost BlogPost hasMany Comment Comment belongsTo BlogPost By backend exposes REST APIs of the form: GET /api/v1/users/1 GET /api/v1/users/1/blog_posts/1 GET /api/v1/users/1/blog_posts/1/comments/1 I'm

How to render component/helper from another one?

℡╲_俬逩灬. 提交于 2019-12-19 17:16:30
问题 I have render-component ( source ) which used to render components/helpers from controller fields. It worked fine for ember 1.9.1 but after updating up to ember 1.12.1 I found changes in API. After updating code I restore simple cases ( like render view by name from some property ). But largest part of functionality still broken. I'm interesting about where can I read more about such things like env ( which used inside components/helpers internal implementation ) morph ( I understand that it

How to render component/helper from another one?

牧云@^-^@ 提交于 2019-12-19 17:15:16
问题 I have render-component ( source ) which used to render components/helpers from controller fields. It worked fine for ember 1.9.1 but after updating up to ember 1.12.1 I found changes in API. After updating code I restore simple cases ( like render view by name from some property ). But largest part of functionality still broken. I'm interesting about where can I read more about such things like env ( which used inside components/helpers internal implementation ) morph ( I understand that it

DS.Model date attribute parses date (YYYY-MM-DD) incorrectly

跟風遠走 提交于 2019-12-19 14:53:19
问题 I am having a issue with my DS.Model parsing dates in the format of "YYYY-MM-DD". They are always one day behind. Here is an example: http://jsfiddle.net/ZUV8v/ Using Date objects on the console I get similar results > new Date('2012-09-20') Wed Sep 19 2012 17:00:00 GMT-0700 (PDT) Is this a ember bug or a javascript bug or a Chrome bug or am I missing something? Chrome Version 21.0.1180.89 on OSX 10.7 回答1: I ran into this just the other day. According to the ECMAScript Specification 15.9.1.15

Sending an action to containing component

霸气de小男生 提交于 2019-12-19 11:54:14
问题 If I have two components: nav-menu nav-button and nav-menu is a block component that would contain nav-button like so: {{#nav-menu}} Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat

Confusion about naming conventions in emberjs

好久不见. 提交于 2019-12-19 11:39:10
问题 Perhaps some folks just know the answer, but I am trying to understand the following: Say you are declaring a view: App.FooView = Ember.View.extend({}); Now referencing this view in App.Router results in the following error: router.get('applicationController').connectOutlet('Foo') When I reference Foo the console states: Uncaught Error: assertion failed: The name you supplied Foo did not resolve to a controller FooController I could not find anywhere in the docs explaining the args. Perhaps

Dynamic segment in ember data adapter

一笑奈何 提交于 2019-12-19 10:11:08
问题 I'm making an app that retrieves data of an API which is not in my control. I have the following scenario: The path for retrieving the posts is /api/posts . So I configured my ApplicationAdapter as follows: App.ApplicationAdapter = DS.RESTAdapter.extend({ namespace: 'api' }); The url for retrieving comments is '/api/posts/1/comments'. You can see that the url is prefixed by the path for retrieving a single post followed by the default path /comments . Ember data defaults to /api/comments .

KeyPress event not working as expected in Ember

十年热恋 提交于 2019-12-19 10:10:32
问题 What I want to do is, make an ajax call whenever user stops entering something in the 'projectname' field & check it against database & show an kind of error message saying, "It exists". But the keypress event is not working as expected, first of all it omits the first letter entered & as a result word is not sent to database completely. Here's my Controller : App.ProjectController = Ember.ArrayController.extend({ actions : { createNew : function() { data = { projectname : this.get(

KeyPress event not working as expected in Ember

十年热恋 提交于 2019-12-19 10:10:11
问题 What I want to do is, make an ajax call whenever user stops entering something in the 'projectname' field & check it against database & show an kind of error message saying, "It exists". But the keypress event is not working as expected, first of all it omits the first letter entered & as a result word is not sent to database completely. Here's my Controller : App.ProjectController = Ember.ArrayController.extend({ actions : { createNew : function() { data = { projectname : this.get(

Ember.js wizard control

蓝咒 提交于 2019-12-19 10:07:11
问题 I have an ember.js wizard control with a number of steps. An ember model object has its various properties set at each stage of the wizard. The only way I can see of changing the view is to use the linkTo helper like this: {{#linkTo steps.two model}}Step 2{{/linkTo}} But this is no good to me as I will need each step that I linkTo to to be a dynamic route: @resource "steps", -> @route "one", {path: 'one/:model_id'} @route "one", {path: 'two/:model_id'} #etc. The dynamic route is no good