ember.js

Use custom helpers in Handlebars which are loaded from an api

孤街浪徒 提交于 2019-12-13 07:34:30
问题 With ember-cli I use some handlebars which are loaded from an api. I'm using variables in the Handlebars templates, but now it would be nice to get render , bind-attr and a custom-helper working. // app/helpers/view-helper.js var ViewTemplateHelper = Ember.Handlebars.makeBoundHelper(function(template, context) { if (Ember.isEmpty(template)) { return; } else if (Ember.isArray(template)) { template = template.get('firstObject.value'); } else { template = template.get('value'); } context =

Access controller properties within Ember Data Transform

≯℡__Kan透↙ 提交于 2019-12-13 07:32:25
问题 I like to access a controller property within Ember Data Transform. Is there anyway how to do that? Perhaps a few words to my use case. I like to create a custom attribute 'encryptedStrings' and use DS.Transform to encrypt / decrypt the string with a given key by using Stanford Javascript Crypto Library. The key should by part a query param in the uri. get method is defined in DS.Transform but I did not get further. Here the relevant parts of the code: App.EncryptedStringTransform = DS

Declarative ember component which passes in a list of objects to be rendered / bound, while passing state that nested components can access?

吃可爱长大的小学妹 提交于 2019-12-13 07:13:52
问题 I'm having a hard time figuring out how to build an ember component which has nested components which are rendered as a list based on an input list, while also allowing state to be passed in which is accessible from the nested components. This is easy in angular: <!doctype html> <html ng-app="angular-accordion"> <head> <style> .angular-accordion-header { background-color: #999; color: #ffffff; padding: 10px; margin: 0; line-height: 14px; -webkit-border-top-left-radius: 5px; -webkit-border-top

Set multiple data with Ember and make it persist on Firebase

给你一囗甜甜゛ 提交于 2019-12-13 07:04:19
问题 I am trying to set data from two models (that has hasMany & belongsTo relationship) and save them to firebase. 'list' data ends up being saved to firebase but not user data. I think I'm doing something wrong at step 3. I'd appreciate your help! import Ember from 'ember'; export default Ember.Route.extend({ model: function() { return this.store.find('list'); }, actions: { createList: function() { var newListTitle = this.controllerFor('lists').get('newListTitle'); var username = this.get(

Ember.js how to extend ember-cli-addon component

ぐ巨炮叔叔 提交于 2019-12-13 07:01:55
问题 I'm using Stripe in my Ember app, and I've set it up following the instructions here : https://github.com/sweettooth/ember-cli-stripe so as my app stands right now, the ember-checkout component installed via this addon is in myappname/node_modules/ember-cli-stripe/app/components/stripe-checkout Now, I want to create a new component "my-stripe-checkout", and have it extend the default ember-cli-stripe component. I have tried: import StripeCheckoutComponent from '../node_modules/ember-cli

Ember Data serialize on fetch and deserialize on POST

99封情书 提交于 2019-12-13 06:57:04
问题 I am using ember data to get data from a remote server. My model definition is as follows - App.Publisher = DS.Model.extend({ name: DS.attr('string'), appName: DS.attr('string'), url: DS.attr('string'), appType: DS.attr('number'), streamType: DS.attr('number'), sslEnabled: DS.attr('number'), protocol: DS.attr('number'), }); And the response from the server is in the following format - { id: 1, name: "aurus", url: "1111", app_name: "superprofs", app_type: 1, stream_type: 1, ssl_enabled: 1,

Get Ember-generated value with jQuery

一曲冷凌霜 提交于 2019-12-13 06:55:45
问题 I'm successfully rendering dynamic data with Ember: <div id="ember_generated">{{result}}</div> I want to get this data on every change with jQuery. The following is the best I can think of, but it doesn't do much: $("body").on("change", "#ember_generated", function() { }); 回答1: What you want to do is: $('body').on('DOMSubtreeModified', '#ember_generated', function () { }); 来源: https://stackoverflow.com/questions/24855890/get-ember-generated-value-with-jquery

Ember CLI ember new fails on ember-cli-qunit

北城以北 提交于 2019-12-13 06:49:35
问题 I've been trying to use Ember CLI to set up a new ember install, but the process keeps dying when trying to install ember-cli-qunit. I'm relatively new to using npm, bower, and ember so maybe this could just be an issue with me being dumb. Here is the dump I get when running ember new webapp I've been working on this for a few hours and can't really figure out how to fix the issue. Thanks in advance 回答1: You must have ran bower as root at some point, and that would've changed the permissions

From firebase storage download file to iframe

删除回忆录丶 提交于 2019-12-13 06:45:29
问题 With below code, I can not download image to iframe. Instead, it downloaded to local drive. in JS: storageRef.child('images/CopyPerson.jpg').getDownloadURL().then(function(url) { var iframe1 = document.getElementById('downloadedCourse'); iframe1.src = url; }).catch(function(error) { // Handle any errors }); in html: <iframe id="downloadedCourse" width="800" height="500" src=""></iframe> However, if I use img instead of iframe, it works as supposed. The reason I need use iframe is because I

ember-data error while loading route: TypeError {}

橙三吉。 提交于 2019-12-13 06:37:52
问题 I recently started to implement the ember data library into my project but now everything is broken, the google chrome console provides me with these errors: - Error while loading route: TypeError {} - Uncaught TypeError: Cannot read property 'id' of undefined - Port: Could not establish connection. Receiving end does not exist. The URL I'm trying to open is: /#/track/85 This is the relevant code: Shoutzor = Ember.Application.create(); Shoutzor.ApplicationAdapter = DS.RESTAdapter.extend({