ember.js

Ember's registerBoundHelper and handlebar blocks

拜拜、爱过 提交于 2019-12-20 02:54:27
问题 So I have taken the 'is' helper block from here and modified it so that it register's it's helper through Ember using registerBoundHelper The reason I did that is because I basically need a handlebars based 'switch' statement. The end result in my handlebars is as follows: {{#is MyProperty 1}} ...Do something here... {{/is}} {{#is MyProperty 2}} ...Do something here... {{/is}} {{#is MyProperty 3}} ...Do something here... {{/is}} {{#is MyProperty 4}} ...Do something here... {{/is}} The is

ember application template classname

喜你入骨 提交于 2019-12-20 02:51:22
问题 I'm having a similar problem to this one: Setting tagName on application template in ember js While I agree that falling back to a legacy view addon can't be the way to go, here too my bootstrap-based CSS is broken by the enclosing div (the height being not set, to be precise). Now a different way to achieve what I need is to set the enclosing div's classNames property (if it exists), like it can be done with a component: export default Ember.Component.extend({ classNames: ['container'] });

Why do nested resource routes reset the namespace in Ember?

倖福魔咒の 提交于 2019-12-20 02:49:12
问题 Let's say I have a Photo model and a Post model, and I want both of those to have Comment 's. In Rails, my routes would look like this: Rails.application.routes.draw do resources :posts, only: [ :show ] do resources :comments, only: [ :index ] end resources :photos, only: [ :show ] do resources :comments, only: [ :index ] end end This generates the following routes: GET /posts/:post_id/comments(.:format) GET /posts/:id(.:format) GET /photos/:photo_id/comments(.:format) GET /photos/:id(.

Capture div containing inline svg and download it as image

ぃ、小莉子 提交于 2019-12-20 02:34:43
问题 I wrote code to capture a screenshot of a page using html5. Everything is fine except when the page contains an svg. When I convert svg to inline svg after that screenshot is not capturing the inline svg. Please check https://jsfiddle.net/7bqukhff/4/ <script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.3/FileSaver.min.js"></script> <script src="https://github.com/niklasvh/html2canvas/releases/download/0.5.0-alpha1/html2canvas.svg.js"></script> <script src="https://github.com

Assertion Fails while Rendering Multiple EmberJS Views

百般思念 提交于 2019-12-20 02:11:01
问题 I am using the view helper multiple times, in order to render the same template but with different parameters every time, mostly booleans acting as option flags. However, I get the following error, whenever I render more than 1 of the same view : Assertion failed: Attempted to register a view with an id already in use: null My element tags do not have an "ember id", e.g. id="ember224" . I replicated the issue in a JSBin: Please note that in JSBin you won't be able to see the error logged in

Assertion Fails while Rendering Multiple EmberJS Views

此生再无相见时 提交于 2019-12-20 02:10:12
问题 I am using the view helper multiple times, in order to render the same template but with different parameters every time, mostly booleans acting as option flags. However, I get the following error, whenever I render more than 1 of the same view : Assertion failed: Attempted to register a view with an id already in use: null My element tags do not have an "ember id", e.g. id="ember224" . I replicated the issue in a JSBin: Please note that in JSBin you won't be able to see the error logged in

ember.js observer for all values

痞子三分冷 提交于 2019-12-19 22:01:46
问题 In Ember.js, is there a good way of adding an observer that will observe all changes on an instance of a subclass of Ember.Object ? ie (coffeescript) Bat = Ember.Object.extend name: null age: null hank = Bat.create name: 'Hank' age: 2 #Something like this hank.addObserverToAll myClass, 'handleChange' 回答1: Here is an implementation: http://jsfiddle.net/Sly7/GMwCu/ App = Ember.Application.create(); App.WatchedObject = Ember.Object.extend({ firstProp: null, secondProp: "bar", init: function(){

How to refresh entity using ember data

萝らか妹 提交于 2019-12-19 20:38:22
问题 In my aplication I recived with websockects info about with objects are changed and ember data should reload them. How can I force emberdata to update already loaded record? How can I force emberdata to get know from server that some records are already delted? 回答1: The only way I could find to achieve something like this is to trigger manually App.store.loadMany(data) with the json (if you have it), or performing a App.store.findQuery(App.Model, {}) , which will invalidate your cache. I

How to refresh entity using ember data

让人想犯罪 __ 提交于 2019-12-19 20:37:02
问题 In my aplication I recived with websockects info about with objects are changed and ember data should reload them. How can I force emberdata to update already loaded record? How can I force emberdata to get know from server that some records are already delted? 回答1: The only way I could find to achieve something like this is to trigger manually App.store.loadMany(data) with the json (if you have it), or performing a App.store.findQuery(App.Model, {}) , which will invalidate your cache. I

how to get the store in a component in ember.js

老子叫甜甜 提交于 2019-12-19 17:39:32
问题 How in the world do i get a handle on the store inside of a component? I'm trying to create an auto-complete component that returns results from the store. App.AutoCompleteComponent = Ember.Component.extend({ //------------------------------------------- // Ember Properites //------------------------------------------- content: Ember.ArrayController.create(), //------------------------------------------- // Instance Properties //------------------------------------------- queryText: "",