ember-cli

Ember CLI - Injecting a service

梦想与她 提交于 2019-12-02 05:59:02
I created the following service and initializer using Ember CLI (generate blueprint): // services/session.js import Ember from 'ember'; export default Ember.Object.extend({ loggedIn: false, ... }); // initializers/session.js export default { name: 'session', initialize: function(container, app) { app.inject('route', 'session', 'service:session'); app.inject('controller', 'session', 'service:session'); } }; However, the session is undefined when attempting to access it in a route or controller. Am I missing a step? // routes/application.js import Ember from 'ember'; export default Ember.Route

ember-cli (2.4.3) not generating DS models

£可爱£侵袭症+ 提交于 2019-12-02 05:48:52
I am very surprised not to get DS models upon generating ember-cli model ember -v ember-cli: 2.4.3 node: 5.10.1 os: darwin x64 ember g model rental Then I get : // app/models/rentals import Model from 'ember-data/model'; export default Model.extend({ }); according to the ember guide , I should get : // app/models/rentals import DS from 'ember-data'; export default DS.Model.extend({ }); what could be wrong ? thanks for feedback There is nothing wrong with the generated code :) Ember Data has been made an addon, and part of that work was to tweak the public ES6 modules so everything doesn't hang

How to render component/helper by name from instance field?

谁都会走 提交于 2019-12-02 05:35:24
Is there way to use component from controller/view field So instead of using {{contact-select label="Label:" contacts=form.prop}} // or {{input-field label="Label:" contacts=form.prop}} // or {{datepicker-component label="Label:" contacts=form.prop}} use some like {{context.helperName label="Label:" contacts=form.prop}} I try use ember-helpers-render-component but it doesn't take component name from property You can use the component helper that was introduced in 1.11.0. Unfortunately there was no built-in way to do it before 1.11.0. If you're not able to upgrade, this thread can point you in

Insert Ember component at cursor in contentEditable element

▼魔方 西西 提交于 2019-12-02 04:55:56
I have a contentEditable div where I want to allow users to type text, as well as insert input elements such as text boxes and dropdowns. The elements will be inserted where the cursor currently is, by allowing the user to click a button outside the editable div. I got it working pretty well following this general example: http://jsfiddle.net/jwvha/1/ which basically does a document.selection.createRange().pasteHTML(html); The problem is that it expects HTML to be passed into the function which inserts the element at cursor. For more complex things, I'd like to be able to insert Ember

Ember-Simple-Auth currentUser example help required

╄→尐↘猪︶ㄣ 提交于 2019-12-02 03:09:57
So I realize that the account example here: https://github.com/simplabs/ember-simple-auth/blob/8863c032fcea6148a5b3365be5d66dc2389d301d/examples/4-authenticated-account.html Provides the code for retrieving the currently logged in account. I just have a few questions about the example as I am trying to get it working in an Ember-CLI app. SimpleAuth is being used in the example however, I don't know where it's coming from as I am trying to import SimpleAuth from ... but I don't know what file to import it from. Furthermore, I am wondering if the response from the server now needs to return the

Simple auth addon seems to not be reading env config

天涯浪子 提交于 2019-12-02 02:42:00
问题 I am following the example here, and I have this in my config/environment.js file: ENV['simple-auth'] = { authorizer: 'simple-auth-authorizer:devise', routeAfterAuthentication: 'landing-pages' }; However, after my app authenticates it tries to go to the index route. I confirmed the configuration variable used had index as the routeAfterAuthentication property by adding a breakpoint in the sessionAuthenticationSucceeded method of the library. I tried import ing the configuration in the

Simple auth addon seems to not be reading env config

。_饼干妹妹 提交于 2019-12-02 01:33:47
I am following the example here , and I have this in my config/environment.js file: ENV['simple-auth'] = { authorizer: 'simple-auth-authorizer:devise', routeAfterAuthentication: 'landing-pages' }; However, after my app authenticates it tries to go to the index route. I confirmed the configuration variable used had index as the routeAfterAuthentication property by adding a breakpoint in the sessionAuthenticationSucceeded method of the library. I tried import ing the configuration in the environment.js file ES6-style, but that doesn't seem possible. Ember Simple Auth actually still relies on the

How to specify compression for custom build environment in Ember

泄露秘密 提交于 2019-12-02 01:27:49
How do I specify compression, bundling and adding invalidation hashes to filenames for a custom environment? The production environment will automatically compress and consolidate files and add invalidation hashes to the file names. I.e. whenever I use ember build --environment=production to trigger the if (environment === 'production'){} case in config/environment.js But I want to create and build for a QA environment that also compresses files and adds invalidation hashes to file names. I.e. the following should also produce compressed files named with invalidation hashes (output the same as

Compiling Compass in an Ember-CLI project

筅森魡賤 提交于 2019-12-01 23:20:13
问题 I'm using ember-cli v0.0.23, and am trying to get the broccoli-compass package working with my project, and I've run into some problems. First, in my Brocfile , I have replaced the standard Ember-CLI "blueprint" version of: var styles = preprocessCss(appAndDependencies, prefix + '/styles', '/assets'); with the following: var compileCompass = require('broccoli-compass'); var styles = compileCompass(appAndDependencies, 'app/styles/app.scss', { outputStyle: 'expanded', sassDir: 'app/styles',

SASS with Ember CLI addons

删除回忆录丶 提交于 2019-12-01 21:35:37
问题 I'd like to know how I can use SASS within an Ember-CLI addon? I have my styles in /app/styles folder, but I'm not sure that's the right location to have them. I have broccoli-sass installed in my addon project, my Dummy test website compiles properly the scss files when I include my folder in /tests/dummy/app/styles/app.scss . @import 'app/styles/app.scss'; But I don't know how I can compile the scss files to go into the /dist/assets/vendors.css , which is the file loaded by projects using