ember.js

Create a <li class=“active”> around an active {{linkTo}}

 ̄綄美尐妖づ 提交于 2019-12-12 08:57:18
问题 What is the cleanest way to get <li class="active"> for the active page in the following Ember app? index.html <script type="text/x-handlebars"> <ul class="nav"> <li>{{#linkTo 'ping'}}Ping{{/linkTo}}</li> <li>{{#linkTo 'pong'}}Pong{{/linkTo}}</li> </ul> </script> app.js App = Ember.Application.create() App.Router.map(function() { this.route("ping", { path: "/ping" }); this.route("pong", { path: "/pong" }); }); 回答1: replace in your template the li tags like so: index.html <script type="text/x

How to extend namespaces with EmberJS

两盒软妹~` 提交于 2019-12-12 08:48:32
问题 I've been programming in Javascript for a while. Recently I made quite a huge jQuery project and applied the Module Pattern as described in this wonderful article: http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth This all went fine and dandy and the code looks slick and manageable, but I felt it could be better. I've spend the day looking for some Javascript frameworks, mostly ones that: Have UI binding support Have a templating system Can work with jQuery Help me

Ember CLI Server Over HTTPS

删除回忆录丶 提交于 2019-12-12 08:39:58
问题 Is it possible to enable HTTPS protocol on Ember's CLI server? Our corporate OAuth system only allows redirects over HTTPS, so I'm in a bit of a bind without this. 回答1: Please note that as of ember-cli 0.2.6, Your app can be served over https. You just need to add your server.key and server.crt files in the ssl/ folder. In your ember-cli file add { ..., "ssl": true } You can also pass it as a command line argument ember s --ssl=true You can create self-signed certificates by following these

Ember JS transition to nested routes where all routes are dynamic segments from a view

自闭症网瘾萝莉.ら 提交于 2019-12-12 08:24:52
问题 We are writing an application using EmberJS. However we are still new with this framework and we're having a hard time resolving some of what may seem to be straight forward. The model is pretty simple, there are 3 models: Queue, Task, and Image. We are using dynamic URI segments for all routes and routes for these models are nested in the form: :queue_id/:task_id/:image_id. The routes are configured this way: App.Router.map(function() { this.resource('queue', {path: ':queue_id'}, function()

ember-data as data for d3

可紊 提交于 2019-12-12 08:16:01
问题 I would like to use my emberdata as data for creating objects within d3. I try to convert the items from the controllers model into new javascript objects and giving this new array to d3 data. here is the code App.GraphicsView = Ember.View.extend( { didInsertElement: function() { var svg = d3.select("#svg"); var data = this.get('controller').get('model').get('content'); var newData = []; for(var i = 0; i < data.length; i++) { newData.push(data[i]); } var graphics = svg.selectAll("rect") .data

Promise based property Ember

 ̄綄美尐妖づ 提交于 2019-12-12 07:59:40
问题 I've got a controller that has a searchQuery and suggestions property. The suggestions come from an AJAX request. How can I make the suggestions property a promise in my Controller? app/controllers/application.js import Ember from 'ember'; const { computed, $ } = Ember; export default Ember.Controller.extend({ searchQuery: '', suggestions: computed('searchQuery', function() { return $.getJSON(`songs/search.json?q=${this.get('searchQuery')}`); }) }); 回答1: I assume you mean, how can I get the

Ember.js: How do I access a specific item in a CollectionView?

眉间皱痕 提交于 2019-12-12 07:59:34
问题 First off I want to say that I really like ember.js. I have tried both Knockout and Angular but found them a bit to obtrusive and everything had to be done their way. I feel like ember allows me a bit more freedom to structure things how you see fit. With that said I have a couple of questions. 1 . I would like to do something like the following which obviously doesn't work: <a href="/item/{{ content.id }}"><h3>{{ content.name }}</h3></a> Instead I would have to create a binding: <a {{

Browser Autofill & databinding

佐手、 提交于 2019-12-12 07:48:13
问题 I have this rather simple form which has a email and a password input field. For my webpage Google Chrome's autofill/save password has activated. Now whenever I load my webpage, Chrome autofills the email and password field (which is nice). Problem is EmberJS doesn't seem to "see" these auto filled values. If I use this.get('userName') for example in the controller, ember returns me blank values. In order to have ember "see" these autofilled values, I have to click on each {{input}} or tab

Save foreign key to other Model with hasMany relation

北慕城南 提交于 2019-12-12 07:38:40
问题 I'm having the following problem. In my app I have a screen to make a new Site . But when I save the new site via an action on the controller, the languages -property isn't sent with the POST -request to the server. The template for adding a new Site is this: <form class="form-horizontal"> <div class="control-group"> <label class="control-label" for="name">Name</label> <div class="controls"> {{view Ember.TextField valueBinding="name"}} </div> </div> <div class="control-group"> <label class=

Ember.js and Pagination

百般思念 提交于 2019-12-12 07:37:40
问题 So the issue is that, I'm trying to load quite a bit of entries from a JSON data file (about 5000 entries), into table rows, and I was wondering what would be the best way to handle pagination. I'm aware of jPages, and other plug-ins, but as I'm fairly new to Ember.js, I wanted to know if there was an Ember way of making this work. I can kinda think of passing the total amount of the entries, manually loop a render through a set amount, but I don't think that would be very portable to other