a blog for those who code

Wednesday 13 July 2016

Ember.js - A JavaScript Framework to Create Web Applications

In this post we will be discussing about Ember.js, a framework for creating ambitious web applications. With simple syntax and an emphasis on reuse and components, this JavaScript framework can make it very easy to create interactive pages. We will be creating a series of posts on Ember.js which includes basics of installation, exploring the framework's architecture, work with Ember objects and collections and last but not the least knowing dependency injection.

Before getting started you should know that Ember is a collection of pieces which will help you to develop a Single Page Application (a.k.a. SPA) which contains routes, components, ember data, templates and models. And its very easy for developers to pick up and understand the project created on Ember.

How to Install Ember

For installing Ember you need the following things in your system and they are :

Git : https://git-scm.com/
Node : https://nodejs.org/en/
Bower : https://bower.io/

You can install Ember by two methods

1. Using Bower

bower init
bower install ember --save

Since Ember has a dependency on jQuery it will pull down jQuery inside bower_components folder along with ember as shown below.

2. Using NPM

npm install -g ember-cli@2.6

How to Initialize Ember

You can initialize Ember in your application using command as shown below

var App = Ember.Application.create({});

You can also check http://jsfiddle.net/ember/ to start with ember where the HTML have the default template as shown below

<script type="text/x-handlebars">
Hello Ember

Ember with ES6 modules can be seen in Ember Twiddle

How to Start a new Ember Application

For creating an application you need to run ember new "YourApplicationName" as shown below

To improve the performance of ember in Windows we have to install ember-cli-windows using the command npm install ember-cli-windows -g and then run ember-cli-winodws in an administrative mode before building your ember application.

At first you need to run Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force in your PowerShell and then run ember-cli-windows as an Administrator as shown below

After doing the above task, run ember server to build the application and navigate to http://localhost:4200 to see your application

In this post we have discussed about Ember.js, which is a great JavaScript framework to create Single Page Application or simply Web Applications. This is the first part of Ember Tutorial. We will be creating a series of posts on Ember.

Please Like and Share the CodingDefined Blog, if you find it interesting and helpful.

No comments:

Post a Comment