ember.js

Idiomatic Emberjs for nested routes but non-nested templates

江枫思渺然 提交于 2019-12-18 02:16:06
问题 This is a follow-up from Understanding Ember routes. Master/detail views are great but I'm trying to have a a hierarchical URL route without nesting their templates. However, I still need access to the parent model for things like breadcrumb links and other references. So /users/1/posts should display a list of posts for user 1. And /users/1/posts/1 should display post 1 for user 1, but it shouldn't render inside the user template's {{outlet}} . Instead, it should completely replace the user

Using primary keys with Ember Data

随声附和 提交于 2019-12-17 22:42:10
问题 I've been struggling for the past few days with primary keys and the last version of Ember Data. I first read how to do it on the Breaking Changes file on GitHub, but it's apparently outdated. I tried several other ways (with the help of Peter Wagenet on IRC), but none of them seem to work. I would like to make slug my primary key on my model, and also since I'm working with MongoDB, I would like to use _id instead of id . Has anyone figured out how to do this? My underlying problem is that

{{content-for 'head'}} Ember-cli

拟墨画扇 提交于 2019-12-17 22:38:06
问题 I've been using Yeoman ember generator for the past 1 month and now, I'd like to give ember-cli a try. I run the generator and launch the app, everything works fine. ember new my-new-app ember server but I'd like to know how does {{content-for 'head'}} in app/index.html works? When looking at other examples from http://www.ember-cli.com/#tutorials, none of them are using this particular helper? Is it because they are using older version of ember-cli? Why weren't they using this content-for

JWT Token strategy for frontend and backend

强颜欢笑 提交于 2019-12-17 22:29:31
问题 I'm writing an application with a front end in emberjs and backend/server-side in a nodejs server. I have emberjs configured so that a user can login/signup with an 3rd party Oauth (google, twitter, Facebook). I have a backend written in express nodejs server that hosts the RESTful APIs. I do not have DB connected to emberjs and I don't think I should anyways since it's strictly client side code. I'm planning on using JWT for communicating between client side and server side. When a user

Is it possible to pass conditionals or other javascript as arguments in ember handlebars?

只愿长相守 提交于 2019-12-17 22:28:33
问题 I would like to pass a true/false statement to my handlebars {{Gd-text-input label="Specify" name="Specify" key="entry.810220554" hideIf="entry.18110 === "Client""}} I would like hideIf to be true if the variable entry.18110 is set to "Client 回答1: First, add this somewhere - Handlebars.registerHelper('ifEqual', function (var1, var2, options) { if (var1=== var2) { return new Handlebars.SafeString(options.fn(this)); } return new Handlebars.SafeString(options.inverse(this)); }); Then.. {{

Workflow for Ember-simple-auth, Torii and Facebook Oauth2

不打扰是莪最后的温柔 提交于 2019-12-17 22:14:36
问题 After my previous question about ember-simple-auth and torii, I successfully authenticate my users with their Facebook accounts. But currently, torii's provider facebook-oauth2 is returning an authorization code from Facebook ; when the promise resolves, I send this authorization code to my backend where I perform a request against Facebook to get the user's id and email : then I authenticate the user on my backend, generating a specific access token and sending back to my ember application.

Javascript (ES6) const with curly braces [duplicate]

夙愿已清 提交于 2019-12-17 21:41:46
问题 This question already has answers here : Javascript object bracket notation ({ Navigation } =) on left side of assign (4 answers) Closed 4 years ago . I'm new to ECMAScript 6, and while trying to learn Ember, I've seen the following code style occassionally: const { abc, def } = Object; I've searched Google and many sites explaining the new ES6 specifications. I know this is not the current implementation, because my console gives an error when I input that. What does this code mean? UPDATE I

Views vs Components in Ember.js

ε祈祈猫儿з 提交于 2019-12-17 21:38:19
问题 I am learning ember.js, and I am trying to understand the difference between a view and a component. I see both as a way of making reusable components. From Ember's website on views: Views in Ember.js are typically only created for the following reasons: -When you need sophisticated handling of user events -When you want to create a re-usable component From Ember's website on components: A component is a custom HTML tag whose behavior you implement using JavaScript and whose appearance you

Iterate over an ember model query

你说的曾经没有我的故事 提交于 2019-12-17 20:55:15
问题 this.store.findAll('game').then(function(results){ // RUN SOME OPERATION ON THEM }) I would like to know how I can play with the results variable. I understand I can do results.get('firstObject') // returns the first object. I'd like to know everything else I can do with it. Is there any api documentation for the results collection? Thanks! 回答1: From ember guides, The below methods, will return the Promise, it will be resolved to Record or RecordArray. store.findAll() returns a DS

Python SimpleHTTPServer

孤者浪人 提交于 2019-12-17 19:51:27
问题 Is there a way to make Python SimpleHTTPServer supports mod_rewrite? I'm trying things with Ember.js with leveraging History API as the location API, and to make it work, I have to : 1) add some vhosts config in WAMP (not simple), or 2) run python -m simpleHTTPServer (very simple) So when I opened it in the browser, localhost:3000 and clicked around the navigation (about and users for example), it worked well. The URLs are changed by Ember.js to localhost:3000/about and localhost:3000/users