ember-cli

relative image source ember js

我们两清 提交于 2019-12-11 05:38:14
问题 i have a problem with assets path in emberjs(ember-cli). I have 2 routes: index and article route, the path for index route is just a / and the path for the article route is article/:article_id router.js Router.map(function() { this.route('article', {path : '/article/:article_id'}); }); In the idnex template, i reference my assets that are in the directory public/assets/ with the following : <img src="/assets/images/image1.jpg/> and its work great, but when i use the same tag in the article

ember “link-to” helper to support “anchor to jump to an element in the page”

天涯浪子 提交于 2019-12-11 05:15:29
问题 I want to pass queryparams and anchor element name in the link-to. like this localhost.domain.com?get=100&interviewId=11#4 I used query params to construct get=100&interview=11 , something like this {{#link-to 'domain.url' (query-params get=100 interviewId=11)class="btn btn-info"}} Link {{/link-to}} How to generate the link with anchor using ember link-to ? Note: Need solution with link-to only, <a href=""> is not needed 回答1: Install ember-href-to addon, ember install ember-href-to You can

Ember.Select with an unbound options list

て烟熏妆下的殇ゞ 提交于 2019-12-11 04:57:46
问题 In an ember.js application that I am working on (ember v1.8.0-beta1, ember-cli), I have a page with a simple sign-up type form that includes a country select dropdown. The problem is that since this field has a relatively large number of options (244 to be exact), there is a big rendering performance hit, the route takes almost a full second longer to render when that select field is added to the template. I assummed that this slowdown was due to Ember having to create bindings for each of

How does Ember-CLI precompile templates?

筅森魡賤 提交于 2019-12-11 04:18:18
问题 Before moving to Ember-CLI, I had used Gulp where I created a task that would precompile the templates and add them to the Ember.TEMPLATES property. Ember would access the templates from there. When working with Ember-CLI though, I noticed that Ember.TEMPLATES is an empty object and yet Ember is still able to resolve its templates. How does Ember-CLI do this? 来源: https://stackoverflow.com/questions/27034489/how-does-ember-cli-precompile-templates

ember-simple-auth deferReadiness until user is loaded

半城伤御伤魂 提交于 2019-12-11 03:15:55
问题 I am using ember-cli-simple-auth and have extended the session object to include the currentUser which is retrieved from the /me endpoint. However, when the page is reloaded and the user is logged in there is a delay until the logged in user information is loaded. I would like to defer the apps readiness until the user is retrieved. I have this in a custom-session initializer. import Session from 'simple-auth/session'; export default { name: 'custom-session', initialize: function(container,

Subtract code from app.js

江枫思渺然 提交于 2019-12-11 02:37:09
问题 To tackle some touch-related problems I have written a script in app.js to reopen and enhance the EventDispatcher. The script is pretty long and contaminates the normally so clean app.js. So I'd like to have my script in a seperate file and than somehow be imported in app.js. What in your opinion is the best (cleanest) way to do this? FYI I'm using Ember CLI 回答1: I would place the script in file in in public/assets/js and load the script using Modernizr.load (Modernizr's implementation of yes

Broccoli-compass and ember-cli 0.39

孤者浪人 提交于 2019-12-11 01:41:32
问题 I recently upgraded ember-cli to .39, and something changed to cause my broccoli-compass code to break. Here's the code: app.styles = function() { return compileCompass(this.appAndDependencies(), this.name + '/styles/app.scss', { compassCommand: 'bundle exec compass', outputStyle: 'expanded', sassDir: this.name + '/styles', imagesDir: 'public/images', cssDir: '/assets' }); }; I get this error: [broccoli-compass] Error: Command failed: Errno::ENOENT on line ["155"] of ~/.rvm/gems/ruby-2.1.1

Ember CLI - Error when using moment.js in route

血红的双手。 提交于 2019-12-11 00:39:22
问题 I have imported moment.js into my project and it seems to work just fine in my controllers but for some reason it is not working in my routes. Controller: // controllers/users.js import Ember from 'ember'; export default Ember.Controller.extend({ date: function() { alert(moment().format('X')); }.property() ... }); Route: // routes/users.js // (Error: /routes/users.js: line 5, col 29, 'moment' is not defined. import Ember from 'ember'; export default Ember.Route.extend({ model: function() {

Handlebar helper syntax in Ember CLI

帅比萌擦擦* 提交于 2019-12-10 21:28:15
问题 In this post Iterating over basic “for” loop using Handlebars.js An example of a 'repeat' helper is layed out. helper Handlebars.registerHelper('times', function(n, block) { var accum = ''; for(var i = 0; i < n; ++i) accum += block.fn(i); return accum; }); template {{#times 10}} <span>{{this}}</span> {{/times}} I can't seem to write this out the 'CLI' way... can someone enlighten me? First of all, it will be it's own helper file in /helpers , and it should have a dash so the resolver

Having trouble unit testing a helper from an addon project

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 20:53:28
问题 https://github.com/stefanpenner/ember-cli/issues/2421 ember-cli: 1.2 I have a boilerplate addon project that has a title-case helper as follows: My Helper app/helpers/title-case.js import Ember from 'ember'; export default Ember.Handlebars.makeBoundHelper(function(string) { if (typeof string === 'string') { //replace dashes with spaces var str = string.dasherize().replace(/-/g, ' '); return str.replace(/\w\S*/g, function(word){ return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase(