ember.js

Ember initializing route model with query

冷暖自知 提交于 2020-01-21 12:18:08
问题 I am trying to initialize a Route's model with a DS query, as follows App.Router.map(function() { this.resource('post', { path: '/posts/:post_slug' }); }); App.PostsRoute = Ember.Route.extend({ model: function(params) { var records = App.Post.find({ slug: params.post_slug }); return records.get('firstObject'); } }); Here, i find a Post by its slug and set the first result as the route model. but since records is populated asynchronously, the model data is not set properly. What is the correct

EmberJS - How to dynamically generate link with linkTo?

会有一股神秘感。 提交于 2020-01-21 11:12:29
问题 Is there a way to dynamically generate a link using the link-to helper by passing a variable with the route path? For example, instead of hard coding the path like this: {{#linkTo "route.subroute" model}}{{model.title}}{{/linkTo}} I want to be able to pass the link-to helper a variable which holds the path like this: {{#linkTo destination model}}{{model.title}}{{/linkTo}} The use case for this is to allow me to consolidate templates which only differ by this path. For instance, if there are

EmberJS - How to dynamically generate link with linkTo?

我与影子孤独终老i 提交于 2020-01-21 11:12:06
问题 Is there a way to dynamically generate a link using the link-to helper by passing a variable with the route path? For example, instead of hard coding the path like this: {{#linkTo "route.subroute" model}}{{model.title}}{{/linkTo}} I want to be able to pass the link-to helper a variable which holds the path like this: {{#linkTo destination model}}{{model.title}}{{/linkTo}} The use case for this is to allow me to consolidate templates which only differ by this path. For instance, if there are

Ember.js session cookie based authentication with Rails and devise

孤者浪人 提交于 2020-01-21 02:14:53
问题 I'm looking to satisfy 3 goals with my Ember.js app authentication using rails, devise and a cookie based session. Redirected to #/sessions/new if they're not logged in. Always show the current user's information in the application template. If the user is logged in and they go to #/some/route directly. The current user should be loaded on load. I've watched these embercast videos: Client-side Authentication Part 1 & Client-side Authentication Part 2. They're a little out of date but helpful.

Add node module to ember CLI app

巧了我就是萌 提交于 2020-01-20 03:58:04
问题 I would like to use this Node.js module https://www.npmjs.com/package/remarkable-regexp in my Ember-CLI application. How do I make it available to the Ember application? I tried it by adding this to the Brocfile.js app.import('node_modules/remarkable-regexp/index.js'); but it fails like this: Path or pattern "node_modules/remarkable-regexp/index.js" did not match any files 回答1: Since remarkable-regexp is a npm module, I believe the best way to integrate it with ember-cli is by using ember

How to add date picker or any general jQuery plugin to Ember-CLI App

℡╲_俬逩灬. 提交于 2020-01-19 12:54:25
问题 So I am trying to add pikaday date picker to Ember-CLI app. I've got the following in my /app/views/calendar-view.js import Ember from 'ember'; export default Ember.TextView.extend({ modelChangedValue: function(){ console.log(this.get('value')); }.observes("value"), didInsertElement: function(){ currentYear = (new Date()).getFullYear(); formElement = this.$()[0]; picker = new Pikaday({ field: formElement, yearRange: [1900,currentYear+2] }); this.set("_picker", picker); }, willDestroyElement:

Not possible to use the latest ember with pre-compiled templates

青春壹個敷衍的年華 提交于 2020-01-17 08:35:51
问题 I have just installed the latest ember starter kit. It has: Ember.VERSION : 1.0.0-rc.5 Handlebars.VERSION : 1.0.0-rc.4 jQuery.VERSION : 1.9.1 I am using grunt-contrib-handlebars@0.5.9 to pre-compile my templates (this is the latest version available). I do not know what version of handlebars is included in that package, but I get the following error when starting the application: Uncaught Template was precompiled with an older version of Handlebars than the current runtime. Please update your

Not possible to use the latest ember with pre-compiled templates

廉价感情. 提交于 2020-01-17 08:35:08
问题 I have just installed the latest ember starter kit. It has: Ember.VERSION : 1.0.0-rc.5 Handlebars.VERSION : 1.0.0-rc.4 jQuery.VERSION : 1.9.1 I am using grunt-contrib-handlebars@0.5.9 to pre-compile my templates (this is the latest version available). I do not know what version of handlebars is included in that package, but I get the following error when starting the application: Uncaught Template was precompiled with an older version of Handlebars than the current runtime. Please update your

ember-cli torii and multiple providers

给你一囗甜甜゛ 提交于 2020-01-17 04:42:32
问题 I am trying to set up an authenticator which would be valid for many providers, because in the backend I am using doorkeeper assertion method which handles the whole flow. I have installed: * "ember-cli-simple-auth": "0.8.0-beta.1" * "ember-cli-simple-auth-oauth2": "^0.8.0-beta.2" * "ember-cli-simple-auth-torii": "^0.8.0-beta.2" * "torii": "^0.3.4" I was looking at this issue Workflow for Ember-simple-auth, Torii and Facebook Oauth2 so I could write this: # templates/login <a {{action

ember-cli torii and multiple providers

大憨熊 提交于 2020-01-17 04:42:06
问题 I am trying to set up an authenticator which would be valid for many providers, because in the backend I am using doorkeeper assertion method which handles the whole flow. I have installed: * "ember-cli-simple-auth": "0.8.0-beta.1" * "ember-cli-simple-auth-oauth2": "^0.8.0-beta.2" * "ember-cli-simple-auth-torii": "^0.8.0-beta.2" * "torii": "^0.3.4" I was looking at this issue Workflow for Ember-simple-auth, Torii and Facebook Oauth2 so I could write this: # templates/login <a {{action