ember-cli

Ember.js, EmberCLI - removing the hash ( # ) from the URL

让人想犯罪 __ 提交于 2019-12-06 19:39:29
问题 So according to Ember's documentation Ember defaults to using the hashchange event. Thats why we have the fancy #/some/url setup. We can also set it to use the browser's history API. I've noticed that most (if not all) sites listed on Built with Ember apparently use the history API. Which makes sense because it make the URL look more natural. All that is to say I (sorta) understand where, how, and why the # gets tacked on. My question relates specifically to EmberCLI. I've noticed that when I

How to use the new ember-cli http-mock for API calls

徘徊边缘 提交于 2019-12-06 18:27:54
问题 I have a simple (so far) ember-cli project, and right now just have one model with FIXTURE data. I would like to mock up API stuff, either with actual JSON files, or with http-mock , which is the ember-cli version 41 name of what used to be api-stub . I'm pretty new to all this, so I really didn't know what to make of the info I found where people were able to get api-stub working, and it doesn't look like any docs on the ember-cli have been updated with http-mock info yet. I did do ember

Embed CSRF token into Ember CLI application

廉价感情. 提交于 2019-12-06 16:47:26
I'm designing my new Ember CLI application. I gonna use Ember Simple Auth for authorisation. And I also need to use CSRF protection. I know how to inject the token to requests. The problem is how to embed the token to the application in a right way. It is required the token to be generated on the backend side and to be embedded into the page. And it should be the same one that API uses to verify requests. In my case API and Ember application would be served by the same web server (most likely Microsoft IIS, since API is build with .NET MVC ). So the web server should generate the token and

Ember-cli moving files to an external folder

℡╲_俬逩灬. 提交于 2019-12-06 15:53:11
So I have an ember CLI app that's in something like 'c:/foo/bar/ember' and want to have the final generated files copy to 'c:/foo/emberApp'. When I do the broccoli build i get all the built files into c:/foo/bar/ember/dist. I'd like to pick some of these files and move them to c:/foo/emberApp. What's the best way to go about this? I've seen people use grunt but this would mean I lose the broccoli speed increase. My brocfile is just the basic ember-cli one, no modifications. I'll include below in case it's of any help. Brocfile.js var EmberApp = require('ember-cli/lib/broccoli/ember-app'); var

How to set the i18n.locale from within an initializer

喜欢而已 提交于 2019-12-06 15:48:51
I would like to set 'i18n.locale' from within an initializer in EmberJS. I am using 1.12 via Ember-CLI with ember-i18n. I tried this import Ember from 'ember'; export function initialize(container, application) { Ember.set('i18n.locale', 'de'); } export default { name: 'user-locale', initialize: initialize } but am receiving Assertion Failed: Path 'i18n.locale' must be global if no obj is given. artych You could get i18n as service:i18n and use instance-initializer to set i18n.locale . //app/instance-initializers/user-locale.js export function initialize(instance) { var i18n = instance

How can I return a well formatted 201 with Express?

不羁的心 提交于 2019-12-06 10:23:18
问题 I'm trying to build todoMVC with ember-cli using the DS.RESTAdapter and express to mock out the calls. The issue I'm getting is that when I try to save a new todo I see this error in the console: SyntaxError: Unexpected end of input at Object.parse (native) at jQuery.parseJSON (http://localhost:4200/assets/vendor.js:8717:22) at ajaxConvert (http://localhost:4200/assets/vendor.js:9043:19) at done (http://localhost:4200/assets/vendor.js:9461:15) at XMLHttpRequest.jQuery.ajaxTransport.send

Ember/Ember-Cli Serving through Apache throws 404

随声附和 提交于 2019-12-06 08:17:49
问题 I'm running into a problem when I try to serve my ember app through Apache. Because the location is set to "history" and not "hash", Apache is trying to load the magic ember routes which don't exist as files. myapp.com/login throws a 404 because there is no login.html. I've done a bit of scouring and its surprising that there isn't much on this which leads me to believe that not many people deploy ember apps on apache. So it's suggested I write Apache URL Rewrite rules, but the one's I have

Insert partial/component at dynamic location

依然范特西╮ 提交于 2019-12-06 08:11:07
I created a blog where I've got a {{downloads}} component showing the downloads which belong to a post. Currently I render the downloads below {{{post.content}}} . I'd like to have a special string withing post.content like [postDownloads] and render {{downloads}} there. Is this somehow possible or are there other approaches to solve this problem? I put together an easy example illustrating one of the use-cases I'm trying to solve: http://emberjs.jsbin.com/raresalihu/3/edit App = Ember.Application.create(); App.IndexRoute = Ember.Route.extend({ model: function() { return { title: "cool post

ember-cli fails on --environment=production (Uncaught Error: Could not find module)

被刻印的时光 ゝ 提交于 2019-12-06 07:36:18
问题 I am using ember-cli and have a problem with selecting the production environment. Specifically, everything works when I run ember serve --environment=development and I get a blank page when I run ember serve --environment=production . In the console, I see: Uncaught TypeError: undefined is not a function Uncaught Error: Could not find module simple-auth/authenticators/base All other things are equal, and all dependencies are up to date. I'm a total noob so I don't even know where to begin on

Requests proxying stop working after update to ember-cli 0.39

三世轮回 提交于 2019-12-06 07:32:29
问题 I have just updated a project from ember-cli 0.37 to 0.39 and api requests are not proxied to the rails backend anymore. I've run ember init and update dependencies but it still doesn't work. ember-cli 0.39 ember 1.6.0-beta.5 ember-data 1.0.0-beta.8 jquery 2.1.0 Thanks. 回答1: This should be fixed in master now. See https://github.com/stefanpenner/ember-cli/pull/1263 for details. 来源: https://stackoverflow.com/questions/24585860/requests-proxying-stop-working-after-update-to-ember-cli-0-39