How to use third party npm packages with ember cli app

The easiest and recommended answer is to use ember-browserify. (as support for bower packages will be removed in the future.) This is an example for using the npm package dexie within an Ember CLI app. Install browserify: npm install ember-browserify –save-dev Install dexie (or whatever module you need): npm install dexie –save-dev Import the module … Read more

Ember.js and RequireJS

EDIT (2012-01-30): I pushed a more complete example in a repo on bitbucket. I have successfully used RequireJS to load Ember.js as well as the datetime addon (github). The Ember namespace itself stays global, but all of my application’s data, including my instance of Ember.Application, is kept within modules through RequireJS. I’m also loading the … Read more

CORS – Cross-Domain AJAX Without JSONP By Allowing Origin On Server

There is no need to use JSONP if you enable CORS. Access-Control-Allow-Origin: http://www.example.com if this header is set in the response, then normal XmlHttpRequest will be able to access the response as if it is like same domain. Check whether this header is set correctly. I hope that this link will help you if you … Read more

Handling errors with the (now default) Ember Data JSON-API adapter

Note the answer below is based on the following versions: DEBUG: ——————————- ember.debug.js:5442DEBUG: Ember : 1.13.8 ember.debug.js:5442DEBUG: Ember Data : 1.13.9 ember.debug.js:5442DEBUG: jQuery : 1.11.3 DEBUG: ——————————- The error handling documentation is unfortunately scattered around at the moment as the way you handle errors for the different adapters (Active, REST, JSON) are all a bit … Read more

Recommended way to include bootstrap library in Ember.JS ember-cli App

BASH: bower install –save bootstrap Brocfile.js: app.import(‘vendor/bootstrap/dist/js/bootstrap.js’); app.import(‘vendor/bootstrap/dist/css/bootstrap.css’); The JS will be added to the app.js, which is linked by default, and the CSS will be added to assets/vendor.css, which as of May 14th, is also added by default. For reference: http://www.ember-cli.com/#managing-dependencies In response to @Joe’s question surrounding fonts and other assets, I was unable … Read more

Using Ember.js, how do I run some JS after a view is rendered?

You need to override didInsertElement as it’s “Called when the element of the view has been inserted into the DOM. Override this function to do any set up that requires an element in the document body.” Inside the didInsertElement callback, you can use this.$() to get a jQuery object for the view’s element. Reference: https://github.com/emberjs/ember.js/blob/master/packages/ember-views/lib/views/view.js

Separate REST JSON API server and client? [closed]

At Boundless, we’ve gone deep with option #2 and rolled it out to thousands of students. Our server is a JSON REST API (Scala + MongoDB), and all of our client code is served straight out of CloudFront (ie: www.boundless.com is just an alias for CloudFront). Pros: Cutting-edge/exciting A lot of bang for your buck: … Read more

tech