Skip to main content

Posts

Showing posts with the label Ember

Deploying Ember Cli App

Now deploying ember-cli is no more a challenge,  ember-cli-deploy  Addon is good solution for deploying ember-cli apps but why settle for good solution when you have awesome solution out there . Yes, you read it right. Thanks  tedconf  for building front_end_builds  and  ember-cli-front-end-builds  . Front_end_builds : Rails engine to manage front end builds and deployments Benefits: JS app can be deployed without redeploying your Rails app Easily smoke test SHAs, branches and releases in your production environment with query params:  http://your-app.com/my-ember-app?branch=new-feature Admin interface lets you easily view, rollback and activate different app versions Admin UI look like this : Ember-cli-front-end-builds:  Easily deploy your Ember CLI app to a  front_end_builds  Rails backend. The deploy process involves: Creating a build of your ember-cli app Uploading your assets to S3 ...

Add handlebar helpers in ember cli project

Updated for ember-cli 1.13.8 To add handlebar helper, create file under 'app/helpers/' directory If your helper name is 'if-first' than your file will be like 'app/helpers/if-first.js' Remember to use dash in helper name so that it will be loaded automatically, for more info read  http://www.ember-cli.com/#resolving-handlebars-helpers . Example: Check for first element in each loop. 'app/helpers/if-first.js' import Ember from "ember" export default Ember.Helper.helper(function(options)  {  if(options[0] === 0){     return options[1];   }else{     return options[2];   } };     then use it in your handlebars template {{#each items as |item index|}}   <div class={{if-first index "active item" "item"}}>            </div> {{/each}}   You can also pass  parameter to helpers like:  {{#format-date date}}  and collect...

Ember data load model using findQuery

Loading Ember model in route is as simple as: App.PostsRoute = Ember.Route.extend({   model : function (params) {      return this .store.find( ' post ', params.post_id );   } }); But when loading model using findQuery then App.PostsRoute = Ember.Route.extend({   model :  function (params) {      return   this .store.find( ' person , {name: params.username} ).then(function(result){         return result.get('firstObject')      });   } }); findQuery return Array therefore select firstObject from Array, Remember to return Array from api for '/persons?name=test_name' url.