ember.js

Right way to do navigation with Ember

陌路散爱 提交于 2019-12-17 08:22:06
问题 What's the "right way" (or at least the options, if there is no single "Ember way" of doing this) for a navigation sidebar? Should I be looking at ContainerViews somehow, or should I just use the new outlet feature and stick the navigation inside my application view? In addition, what's the "right way" to set an .active class on an li depending on the URL (I'm using routing)? Is there some kind of a helper for this? 回答1: <Update date="2013-01-16"> The previous examples are no longer valid

CORS - Cross-Domain AJAX Without JSONP By Allowing Origin On Server

戏子无情 提交于 2019-12-17 07:40:33
问题 I have two separate apps on the same server, with the EmberJS one trying to do cross-domain calls to my backend API. I set up my backend API to allow cross-domain requests from that specific origin. Is there a way however, to avoid using JSONP with such a set up? $.ajax is blocking cross-domain requests before they ever get sent. If not, what is the point of CORS, which server-side I had implemented to accept requests from my JS front-end source? EDIT AJAX request: $.ajax({ url: "api.lvh.me

Recommended way to include bootstrap library in Ember.JS ember-cli App

心已入冬 提交于 2019-12-17 06:24:32
问题 I am trying to install properly Twitter Bootstrap in my current ember-cli project. I did install bootstrap with bower : bower install --save bootstrap Now the library is downloded in /vendor/bootstrap/dist/(css|js|fonts) I tried what is mentioned here : http://ember-cli.com/#managing-dependencies replacing path and css files names but I get errors regarding the Brocfile.js file. I think the brocfile format has changed too much compared to the example. I also tried to @import with the /app

Separate REST JSON API server and client? [closed]

孤人 提交于 2019-12-17 05:15:12
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago . I'm about to create a bunch of web apps from scratch. (See http://50pop.com/code for overview.) I'd like for them to be able to be accessed from many different clients: front-end websites, smartphone apps, backend webservices, etc. So I really want a JSON REST API for each

CRUD blueprint overriding in sails.js

十年热恋 提交于 2019-12-17 02:49:09
问题 According to this closed issue in sails: https://github.com/balderdashy/sails/issues/835 CRUD Blueprint Overrides "absolutely, this is coming in v0.10" I'd like to modify the blueprints in my sailsjs service to allow named roots (consuming in ember). Currently I'm having to customize every controller I create with actions that are largely duplicates of what is already in the blueprints. I suspect that I can move this code out of my controllers now and into a blueprints override area, but I'm

How can I execute array of promises in sequential order?

血红的双手。 提交于 2019-12-17 02:35:06
问题 I have an array of promises that need to run in sequential order. var promises = [promise1, promise2, ..., promiseN]; Calling RSVP.all will execute them in parallel: RSVP.all(promises).then(...); But, how can I run them in sequence? I can manually stack them like this RSVP.resolve() .then(promise1) .then(promise2) ... .then(promiseN) .then(...); but the problem is that the number of promises varies and array of promises is built dynamically. 回答1: If you already have them in an array then they

Insert partial/component at dynamic location

痴心易碎 提交于 2019-12-14 04:25:08
问题 I created a blog where I've got a {{downloads}} component showing the downloads which belong to a post. Currently I render the downloads below {{{post.content}}} . I'd like to have a special string withing post.content like [postDownloads] and render {{downloads}} there. Is this somehow possible or are there other approaches to solve this problem? I put together an easy example illustrating one of the use-cases I'm trying to solve: http://emberjs.jsbin.com/raresalihu/3/edit App = Ember

ember.js model data is not being output by the collectionView

╄→гoц情女王★ 提交于 2019-12-14 04:21:39
问题 I am at sea, and would be grateful for any help, with the latest version of Ember. Using the todo example, i've tried to include routes and DS models in the following adapted http://jsfiddle.net/5HMzu/3/ When I use a #each controller in the handlebar template, output is as expected; replacing that with a CollectionView and trying to tie that to the data source, nothing is being output. The inserted code: App.PersonCollectionView = Ember.CollectionView.extend({ itemViewClass: "App

Force reload of dirty/invalid model in Ember

依然范特西╮ 提交于 2019-12-14 04:21:28
问题 I am trying to build out edit functionality for a Goal record. On the Goal index page, there is an edit button next to each goal. When clicked, each field becomes editable. Upon clicking Save, the changes are saved to the server. So far so good. There is also a Cancel button. When a user clicks it, I need to reset the state of the model to what it was before they changed things. goal.rollback() in the controller works fine for this. Except, if the user has already clicked Save but there were

Emberjs sort content by date using sortProperties

白昼怎懂夜的黑 提交于 2019-12-14 03:49:09
问题 I am trying to use Emberjs sortProperties to sort content by date in this jsfiddle . My model has a startTime property which I tried to sort by but it didn't work. I then created a computed property called todayEvent in the controller which returns events that match the passed in date and I tried to sort that but it also didn't work. All I am trying to do is list events occurring on same day but in such a way that time of the day in chich event occurs is sorted in ascending order for example,