ember.js

Accessing the current model within a yield

假如想象 提交于 2020-01-17 04:41:13
问题 I'm looking for how to access the current model with-in an each from a yield statement. Any ideas? Model models: [{ id: 1, name:'Red', value: '#ff0000' }, { id: 2, name:'Yellow', value: '#ffff00' }, { id: 3, name:'Blue', value: '#0000ff' }]; Template {{#table-list models=models config=colorModelTableListConfig}} {{model.id}} {{model.name}} {{model.value}} {{/table-list}} Component (table-list) <!-- Searching markup--> <table> {{#each th in config.tableHeaders}} <th>{{th}}</th> {{/each}} {{

Ember-data resets queryParam to default value

心已入冬 提交于 2020-01-17 02:39:10
问题 In my model, I have a queryParam status which is set to refreshModel true in my route. queryParams: { status: { refreshModel: true } } In my controller, this param is set to 'opened' by default : App.ConversationsController = Ember.ArrayController.extend({ queryParams: ['status'] status: 'opened' }); Everytime I set this param to something else, for example 'all', Ember-data resets it to 'opened' and makes two calls instead of one to my model hook, and this behavior has been observed with

Ember.js - How can I save data to session from authenticator?

余生长醉 提交于 2020-01-16 22:00:23
问题 I have tried doing this.get('session') but it gives me nothing. I want to save data to my session I only seem to get the information I need from the authenticator but can't seem to be able to pass it around. (Tried a couple of methods suggested on SO but none seem to be able to work from the autheticator) import Ember from 'ember'; import Torii from 'ember-simple-auth/authenticators/torii'; const { service } = Ember.inject; export default Torii.extend({ torii: service('torii'), authenticate

Expected format for validation errors in Ember Data (using ActiveModel::Serializers)

≯℡__Kan透↙ 提交于 2020-01-16 19:14:29
问题 Unfortunately, ActiveModel::Serializers does not currently support validation errors, though they're scheduled for 1.0. Until then, I've got to hack a solution of my own. The big problem? I have no idea what format Ember Data's ActiveModelAdapter expects these errors to be in. I tried simply passing in the errors property, but Ember Data didn't pick up on it: class MySerializer < ActiveModel::Serializer attributes :errors end So what should I pass in instead? 回答1: I use this method to render

EmberJS - How to partially nest parent and sub routes?

早过忘川 提交于 2020-01-16 17:59:07
问题 I have a lot of nested urls. e.g. Project list -> Project detail The Project list template's route should only display the list if the route Project details is not called. I did it by creating a computed property that check the currentRouteName of the server routing . Then I add this to my template: <div>Element that should be display in both route.</div> {{#if isProjectDetail}} {{outlet}} {{else}} <ul> ... </ul> {{/if}} Note that some elements of Project list should be still display in

Cannot read property 'inlineReference' of undefined in rasterizeHTML from jspdf

走远了吗. 提交于 2020-01-16 17:08:27
问题 I'm using jspdf to render HTML to PDF in an Ember app. jspdf is included using the ember-js-pdf plugin, which is getting me jspdf v1.5.3. html2canvas seems to have recently moved to a promise-based model which jspdf isn't ready for, so I tried rasterizeHTML.js instead. Once I made it available in the app by adding app.import('node_modules/rasterizehtml/dist/rasterizeHTML.js'); I'm able to build, but then when I print I get this error: Uncaught TypeError: Cannot read property 'inlineReferences

Cannot read property 'inlineReference' of undefined in rasterizeHTML from jspdf

≡放荡痞女 提交于 2020-01-16 17:08:09
问题 I'm using jspdf to render HTML to PDF in an Ember app. jspdf is included using the ember-js-pdf plugin, which is getting me jspdf v1.5.3. html2canvas seems to have recently moved to a promise-based model which jspdf isn't ready for, so I tried rasterizeHTML.js instead. Once I made it available in the app by adding app.import('node_modules/rasterizehtml/dist/rasterizeHTML.js'); I'm able to build, but then when I print I get this error: Uncaught TypeError: Cannot read property 'inlineReferences

Dynamically Create Inputs with Ember (and retrieve their values)

夙愿已清 提交于 2020-01-16 13:26:33
问题 I'm working with Ember.JS on the front-end and need to be able to create x number of input checkboxes depending on my model. Basically I want to do something like: {{#each model}} {{input type="checkbox"}} {{/each}} While that works perfectly fine, I'm not sure how I can retrieve the values of x checkboxes from the controller upon submission. If it were just one, I might say: {{input type="checkbox" checked=boxIsChecked}} But I'm not sure how I can enumerate these inputs so that I might say:

Observe Ember Data store changes in component

孤街浪徒 提交于 2020-01-16 07:45:34
问题 I have a component which creates record for a specific model like this: export default Ember.Component.extend({ store: Ember.inject.service(), addRecord(account) { this.get('store').createRecord('update', { authUid: account.get('authUid'), service: account.get('platform') }); } }); I have another component that needs to observe changes done to a particular model (i.e. if records are added or deleted), and show them in that component. export default Ember.Component.extend({ store: Ember.inject

emberjs router class active

时光怂恿深爱的人放手 提交于 2020-01-16 04:51:44
问题 I know i can find examples of this but i cant put it into my code without errors... just dont know why. I want start with set class="menu-active" to first in menu. <li><a {{action gotoAbout}} >About</a></li> And later when somebody click other position of menu move class="menu-active" to this position. http://jsfiddle.net/kwladyka/LGArM/3/ And the bonus question: Do you have any remarks to make my code better? HTML <script type="text/x-handlebars" data-template-name="application"> {{view App