ember.js

Set directory for NPM

随声附和 提交于 2019-12-24 22:57:07
问题 I'm working with git-bash on win 7. I want to develop an ember project and I am working on a thumb drive. I have installed node on my E drive and added the path to the env vars. $ npm install -g ember-cli C:\Users\me\AppData\Roaming\npm\ember -> C:\Users\me\AppData\Roaming\npm\node_modules\ember-cli\bin\ember C:\Users\me\AppData\Roaming\npm\� -> C:\Users\me\AppData\Roaming\npm\node_modules\ember-cli\bin\ember + ember-cli@2.16.2 updated 553 packages in 89.25s $ which npm /e/nodejs/npm $ which

Ember render template using yield

人盡茶涼 提交于 2019-12-24 21:22:57
问题 I am trying to implement {{#my-custom-component}} {{my-other-component field=(some-section someSection "PARAM_1" "PARAM_2") onChangeField=(action 'enable' "PARAM_3")}} {{/my-custom-component}} So I want to display/render my-other-component inside my-custom-component. So I'll have a {{yield}} inside my-custom-component. Currently with the above, I am getting RangeError: Maximum call stack size exceeded I suspect I am not passing the params properly. 来源: https://stackoverflow.com/questions

Ember.js get view triggering event in the router

青春壹個敷衍的年華 提交于 2019-12-24 20:42:22
问题 I have a view triggers an event which is handled inside the router state. <button {{action signUp this}} type="button" class="btn btn-primary">Sign-Up</button> here is a handler: signUp: (router, event) -> //how do I get an instance of the "View" class triggered an event? I can use event.context to get all bound properties of the View class, but in fact I want to get a complete instance of the View class which has triggered the event. Any hints how to achieve this? 回答1: If you want to do

following emberjs guide for #linkTo helper does not display individual post

主宰稳场 提交于 2019-12-24 20:40:42
问题 I have a jsfiddle with a route as shown below, which is exactly thesame as the one in emberjs guides and when I click on the #linkTo helper attached to {{post.title}} , it ought to show me the individual post but it does not and instead the console shows this errors: Uncaught Error: assertion failed: Cannot call get with 'id' on an undefined object. Also when I click the posts link on the home page, it displays all the titles but in the console, it also shows this error: Uncaught Error:

Accessing rails relationships with Ember.js

风流意气都作罢 提交于 2019-12-24 19:37:03
问题 I'm just starting to learn ember and am writing a simple app that reads from a database. I've gotten it to work with fixtures how I want and have just started making some progress reading from a database. Right now my problem is that I can't access children elements - I have a parent class that I am responding to with json through a serializer, and I am serving the children elements in the json request. However, I don't know where to go from here to get the parent class in ember to read and

how to destroy and recreate a controller object in Ember framework

匆匆过客 提交于 2019-12-24 19:33:59
问题 I am using Ember 2.12, there are two controllers - one for applicant and other for coapplicant for our application flow. When the user decides to delete the coapplicant, I am trying to get rid of its state (that unfortunately lives in the coapplicant controller instead of a separate data object). so i am trying to destroy the controller and then recreate it the next time the page loads. in the resetController state, I call this.destroy(); And in the routes/form.js page, in the setupController

emberjs template compile doesn't work in rc1

眉间皱痕 提交于 2019-12-24 19:31:53
问题 I have Esploreo.TE.Views.ItemView = Ember.View.extend({ elementId : "item", templateName : 'itemTemplate' }); and a template like <script type="text/x-handlebars" data-template-name="itemTemplate"> content of templat </script> and all works good. But i don't to want to use this type of coding. In previous Ember versions it was possible to write the template code in the definition of view, like this: Esploreo.TE.Views.ItemView = Ember.View.extend({ elementId : "item", template: Em.Handlebars

ember-data: modeling a user-maintained list of products

瘦欲@ 提交于 2019-12-24 19:30:40
问题 Trying to wrap my head around how to efficiently model and code a "saved items" list for logged-in users. I want the user to be able to click "save item" from a product page, and it will add the item to a list kept in their user profile that has its own route that displays their items and allows them to manage the list. On that route, anytime there are changes to the list (like, item is removed), it should refresh to reflect the changes. I'd think the user model would look something like this

Ember.js: Should component templates turn into views when the js file is deleted?

主宰稳场 提交于 2019-12-24 17:27:49
问题 I have a component with an empty Ember.Component.extend(); and a template. When I delete the js file, the component template still works and renders, but as a view instead of a component. Since the template is in "templates/components/" and Ember can find it and render it, shouldn't Ember be smart enough to render it as a component and not a view? Or is this expected behavior? 来源: https://stackoverflow.com/questions/37846577/ember-js-should-component-templates-turn-into-views-when-the-js-file

How to retrieve models from .json file in ember.js

扶醉桌前 提交于 2019-12-24 17:25:31
问题 Following is my folder structure Sample/ css/ js/ libs/ data/ employees.json app.js index.html app.js App = Ember.Application.create({ LOG_TRANSITIONS: true }); App.Router.map(function(){ this.resource("employees"); }); App.ApplicationAdapter = DS.RESTAdapter.extend({ namespace: "localapps/EmberProjects/Sample/js/data", url: "employees.json" }); App.Employee = DS.Model.extend({ name : DS.attr("string") }); App.EmployeesRoute = Ember.Route.extend({ model: function() { return this.store.find(