SlideShare a Scribd company logo
Ember
Build an ambitious application
By : Chandrasekar.G
What is Ember ?
Ember is an open source javascript framework.
Collection of libraries that are written in pure MVC architectural pattern.
Why Ember ?
Avoid boilerplate codes .
Creates a standard application architecture .
Designed and developed to create and manage large web applications.
Dynamic data bindings.
Ember follows pure MVC Architectural pattern that

Improves application testability .

Keeps application codes modular.
Previous development
In a Software Application , User interface get change often
more than logics and data. Application might be have several
parts / state ,So each state of application may have different
layout , data displaying styles. So each time user navigate
these things are get shuffle when application state change.
In the previous programming development business logics and
presentation logics are tightly coupled in the codes of JSP and
JS files .
Disadvantages
New development
In the new development data logics , business logics and
presentation logics are get separated with modular
programming pattern.
One the main benefit of the decoupling is application will have
ability to develop an independent presentation application .
Architectural pattern
Architectural pattern is a solution to solve design problem .
Architectural pattern which gives the clear pictures about application
system.
It describes the subsystems and components of the application and
relation between them.
In software world which used to address different kind of issues such as :-

Performance 

Security
Architectural patterns
Model - View - Controller
Model - View - Adapter
Model - View - View Model
Some list of architectural patterns which used in software applications.
MVC Overview
Model

The model component covers the list application parts :-

Data.

Set of rules to store data in structure. 

Logics and functions.
View

View component represents the model in different types such as 

Chart 

Pivot 

User customised view
Controller

The Controller component behaves like a mediator which sends the commands to 

View and Model.
MVC software design pattern has divided as three components Model, View Controller.
MVC Good Explanation
This explanation found on stackoverflow.com.
View : "Hey, controller, the user just told me he wants item 4 deleted."
Controller : "Hmm, having checked his credentials, he is allowed to do that... 

Hey, model, I want you to get item 4 and do whatever you do to delete it."
Model : "Item 4... got it. It's deleted. Back to you, Controller."
Controller : "Here, I'll collect the new set of data. Back to you, view."
View : "Cool, I'll show the new set to the user now."





By : Andres Jaan Tack
Software design layer
Book for special offer
Name
Contact
Address
Submit Cancel
ViewModel Controller
Reset Form
Update Form
Cancel
Starting with Ember
Requirements 

jquery.js

ember.js

handlebars.js

ember-data.js
Understanding Ember
Template

In Ember, Template concept is used to define user interface of the application
Router

Router is an Ember class which manages the application state .
View / Components 

View class is responsible for data binding with support of templates.

One more option which provides that developer can implement DOM events for the
user interactions .
Model

Model is a class that defines properties , structure and behaviour of the data.
Controller

Ember controllers usually consist the code to execute the tasks.
Core concept of Ember
Template
Template is basically a rear surface of model or presentation.
One of the advantage of using template library is when the model get change
template also get change automatically.
Template engines are written in UI data binding software design pattern.
Ember supports handlebars template engine by default , though which provides
flexibility to use other templates engine such emblem and etc… .
Dynamic UI data binding
Some example Client side template engines 

Emblem

Underscore JS template 

Mustache JS

EJS

Dust JS

Handlebars
Handlebars JS takes the given HTML string and It’s own language syntax
codes and compiles them to the javascript method.
Handlebars JS is an extension of Mustache JS template engine and
developed to supersede mustache JS.
Logic-less template engine.
Using handlebars JS
Defining simple handlebar template
<script id=“template” type=“text/x-handlebars”>
Welcome, <b> {{user.name}} </b>
</script >
“ {{ }} ” expression represents template 

model data as HTML
Example : Simple handlebar template
<script>
var context = {
user : { name : "Jack Sparrow"}
}
var templatecontent = $("#template").html();

var template = Handlebars.compile(templatecontent);
$('body').append(template(context));
</script>
Getting template by ID
Compiler makes template function
Passing the data as parameter in
the template function
Handlebars Helpers
Block Helpers

Handlebars JS provide predefined block level expressions such as conditional

statements and loops.
Custom Helper

Handlebars JS allows developer to create their own helper with option of resister helper
Actions Helpers

Handlebars actions helpers are mainly implemented to handle DOM events. 

Actions related codes will be maintain in the controllers.
View Helper

View helper is used to define template with help of view class .. will be cover on ember view
Template Helpers

There are three expression “ template “, “ partial ” and “render” which are used to includes 

specific template in the context .
Outlet

Outlet helper tells to render the route related template and allows to render child templates.
Handlebars JS has some expressions for dynamic data binding
Using Block helpers

<div class={{#if alreadyVisited}} "alreadyVisited"{{/if}} "notVisited">
	 {{name}}
</div>
Example : Conditional statements
Conditional statements If, else, unless
Each
{{#each bookmarks}}
!
{{/each}}
<div class="visitedUsers">
<br> <b> Visited user</b> :
{{#unless visitedUser.length}}
No one visited yet this site
{{else}}
{{visitedUser}}
{{/unless}}
</div>
Note : Else if conditions are not supported
Example : Each in Handlebar
with
with is a block helper which helps to change the context of the template .
Example : "with" Block helper
{{#with otherActivities}}
{{sports}}
<br>
{{music}}
{{/with}}
Custom Helpers
Handlebars.registerHelper("createController", function (string){
return string+"Controller = Em.Controller.extend({})";
});
Example : Custom Block helper
Following below codes will create a new helper called creteController 

so developer can use In that template
Ember Application
var App = Em.Application.create();
Creating Application
Following code will create the instance of ember application. Application provides some
default package of components.
!
We can implement application view with the help of handlebar like following code
!
	 	 <script type=“text/x-handlebars” >	 	 	 	
	 	 	 HTML code goes here
	 	 </script>
!
If we don’t mention any ID in It will render the application view .
Basically It makes the body element as ember application .Instead of body element
We can specify the Application view element with option of rootElement.
var App = Em.Application.create({
	 rootElement : “main”
});
Debug configuration
LOG_STACKTRACE_ON_DEPRECATION 	: 	 true,
LOG_BINDINGS 	 	 	 	 : 	 true,
LOG_TRANSITIONS 	 	 	 : 	 true,
LOG_TRANSITIONS_INTERNAL 	 	 : 	 true,
LOG_VIEW_LOOKUPS 	 	 	 : 	 true,
LOG_ACTIVE_GENERATION 	 	 : 	 true
{{debugger}}
Following code will throw the error in template
Get logs of specified layer
{{log controller}}
List of properties are available for logging
Router
Ember router class store the application state in browser’s URL.
Ember creates router object on application loads named App.Router.
Routes classes are generates with ember UpperCamelCase
convention.
Application router comes by default with the set of route objects
called IndexRoute and ApplicationRoute.
ApplicationRoute will load in the all resource by default.
Router in Action
App.Router.map(function(){});
App.Router loads IndexRouter and ApplicationRoute
We can create routes with the option of “resource” and “route”. 

We can override IndexRouter and ApplicationRouter to make more functionality to the application.

App.IndexRoute = Em.Route.extend({
init : function() {
console.log("Index Route loading ");
}
});
App.ApplicationRoute = Em.Route.extend({
init : function() {
console.log("Application Route loading ");
}
});
Defining Route
App.Router.map(function(){
this.resource("users");
this.resource(“user",{path:"users/:id"});
});
This code will create users route
This code will create dynamic segments
Example : Route and Dynamic route
So the generated routes are would be UsersRoute, UserRoute , So the
application states are would be access through the URL 



1. http://app/users/
2. http://app/users/ 1
Application
Router
Resource Route
View
On Application load ember creates Application view and parallel application template by default.

Creating View
App.CustomView = Em.View.extend({
classNames: [‘customView']
tagName : “span”
click 	 : function (){
}
});
This code will create View class instance
{{#view App.CustomView}}
Custom View
{{/view}}
Rendering template view helper
Example : Defining view
Ember Application view lifecycle
Application
Views
Container
Ember -Handlebar
Handlebar compiler
Metamorph
<script >
handlebars
Renders HTML
Model
Defining Ember model
App.Info = DS.Model.extend({}); This code will create the model instance
Defining attributes
App.Info = DS.Model.extend({

name : DS.attr('string'),
version : DS.attr('number'),
author : DS.attr('string'),

hasReleased : DS.attr(‘boolean’ , {defaultValue: false})

});
Defining data key and It’s type
Setting default
Example : Example model
Controller
Ember JS controllers provides developer to write and present data with display logics .
Defining action using controller
28
App.PipeController = Em.Controller.extend({
title : "Manage your pipes",
actions : {
pipeNow : function (){
console.log("You can pipe now ",this.get('pipeNow'));
}
},
});
Here the logic codes go
Example :
Example of Controller
action
Basics ends here
Ad

Recommended

Jsf intro
Jsf intro
vantinhkhuc
 
Getting Started with Angular JS
Getting Started with Angular JS
Akshay Mathur
 
A Complete Tour of JSF 2
A Complete Tour of JSF 2
Jim Driscoll
 
Angular Js Get Started - Complete Course
Angular Js Get Started - Complete Course
EPAM Systems
 
Angular js 1.3 basic tutorial
Angular js 1.3 basic tutorial
Al-Mutaz Bellah Salahat
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed nov 2014
Sarah Hudson
 
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
AngularJs Superheroic JavaScript MVW Framework Services by Miracle Studios
Learnimtactics
 
Angular JS
Angular JS
John Temoty Roca
 
Angular js presentation at Datacom
Angular js presentation at Datacom
David Xi Peng Yang
 
Angular js
Angular js
vu van quyet
 
AngularJs (1.x) Presentation
AngularJs (1.x) Presentation
Raghubir Singh
 
Struts Introduction Course
Struts Introduction Course
guest764934
 
Design Patterns in ZK: Java MVVM as Model-View-Binder
Design Patterns in ZK: Java MVVM as Model-View-Binder
Simon Massey
 
Hastening React SSR - Web Performance San Diego
Hastening React SSR - Web Performance San Diego
Maxime Najim
 
Introducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and server
Spike Brehm
 
當ZK遇見Front-End
當ZK遇見Front-End
祁源 朱
 
Java server faces
Java server faces
Fábio Santos
 
Angular Project Report
Angular Project Report
Kodexhub
 
Angular js
Angular js
Behind D Walls
 
Introduction to jsf 2
Introduction to jsf 2
yousry ibrahim
 
Spring MVC 3.0 Framework (sesson_2)
Spring MVC 3.0 Framework (sesson_2)
Ravi Kant Soni ([email protected])
 
Angular JS - Introduction
Angular JS - Introduction
Sagar Acharya
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
Introduction of angular js
Introduction of angular js
Tamer Solieman
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
Introduction to single page application with angular js
Introduction to single page application with angular js
Mindfire Solutions
 
Jsf Framework
Jsf Framework
Marimuthu Udayakumar
 
Angular Js Basics
Angular Js Basics
أحمد عبد الوهاب
 
QA-QCREKirkland2015
QA-QCREKirkland2015
Richard Kirkland
 

More Related Content

What's hot (20)

Angular js presentation at Datacom
Angular js presentation at Datacom
David Xi Peng Yang
 
Angular js
Angular js
vu van quyet
 
AngularJs (1.x) Presentation
AngularJs (1.x) Presentation
Raghubir Singh
 
Struts Introduction Course
Struts Introduction Course
guest764934
 
Design Patterns in ZK: Java MVVM as Model-View-Binder
Design Patterns in ZK: Java MVVM as Model-View-Binder
Simon Massey
 
Hastening React SSR - Web Performance San Diego
Hastening React SSR - Web Performance San Diego
Maxime Najim
 
Introducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and server
Spike Brehm
 
當ZK遇見Front-End
當ZK遇見Front-End
祁源 朱
 
Java server faces
Java server faces
Fábio Santos
 
Angular Project Report
Angular Project Report
Kodexhub
 
Angular js
Angular js
Behind D Walls
 
Introduction to jsf 2
Introduction to jsf 2
yousry ibrahim
 
Spring MVC 3.0 Framework (sesson_2)
Spring MVC 3.0 Framework (sesson_2)
Ravi Kant Soni ([email protected])
 
Angular JS - Introduction
Angular JS - Introduction
Sagar Acharya
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
Introduction of angular js
Introduction of angular js
Tamer Solieman
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
Introduction to single page application with angular js
Introduction to single page application with angular js
Mindfire Solutions
 
Jsf Framework
Jsf Framework
Marimuthu Udayakumar
 
Angular Js Basics
Angular Js Basics
أحمد عبد الوهاب
 
Angular js presentation at Datacom
Angular js presentation at Datacom
David Xi Peng Yang
 
AngularJs (1.x) Presentation
AngularJs (1.x) Presentation
Raghubir Singh
 
Struts Introduction Course
Struts Introduction Course
guest764934
 
Design Patterns in ZK: Java MVVM as Model-View-Binder
Design Patterns in ZK: Java MVVM as Model-View-Binder
Simon Massey
 
Hastening React SSR - Web Performance San Diego
Hastening React SSR - Web Performance San Diego
Maxime Najim
 
Introducing Rendr: Run your Backbone.js apps on the client and server
Introducing Rendr: Run your Backbone.js apps on the client and server
Spike Brehm
 
當ZK遇見Front-End
當ZK遇見Front-End
祁源 朱
 
Angular Project Report
Angular Project Report
Kodexhub
 
Angular JS - Introduction
Angular JS - Introduction
Sagar Acharya
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
Introduction of angular js
Introduction of angular js
Tamer Solieman
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
Introduction to single page application with angular js
Introduction to single page application with angular js
Mindfire Solutions
 

Viewers also liked (13)

QA-QCREKirkland2015
QA-QCREKirkland2015
Richard Kirkland
 
history of internet by samandeep
history of internet by samandeep
Pind Bijti Uttrakhand
 
Happy new year 2015
Happy new year 2015
Sleeba John Chungath
 
Threat in CPF-247
Threat in CPF-247
Rana Maqsood Ahmad Ahmad
 
Loving suggestions
Loving suggestions
Sleeba John Chungath
 
Internet
Internet
Pind Bijti Uttrakhand
 
Loving suggestions
Loving suggestions
Sleeba John Chungath
 
List Rental 101
List Rental 101
BorgDirect Marketing
 
J.p. morgan iraq and mena trade forum monday 24 september presentation
J.p. morgan iraq and mena trade forum monday 24 september presentation
Rabih BL Abed
 
Sulap angka
Sulap angka
Jamanatul Iman Al Hikam
 
عشرة دروس من اليابان
عشرة دروس من اليابان
ybawazer
 
J.P. Morgan Iraq and MENA Trade Forum Tuesday 25 September Presentation
J.P. Morgan Iraq and MENA Trade Forum Tuesday 25 September Presentation
Rabih BL Abed
 
Ad

Similar to Create an application with ember (20)

Introduction to Ember.js
Introduction to Ember.js
Vinoth Kumar
 
Ember.js: Jump Start
Ember.js: Jump Start
Viacheslav Bukach
 
Riding the Edge with Ember.js
Riding the Edge with Ember.js
aortbals
 
Introduction to Ember.js
Introduction to Ember.js
Jeremy Brown
 
A Beginner's Guide to Ember
A Beginner's Guide to Ember
Richard Martin
 
Intro to emberjs
Intro to emberjs
Mandy Pao
 
Getting into ember.js
Getting into ember.js
reybango
 
Workshop 16: EmberJS Parte I
Workshop 16: EmberJS Parte I
Visual Engineering
 
Parse Apps with Ember.js
Parse Apps with Ember.js
Matthew Beale
 
Ember presentation
Ember presentation
Daniel N
 
Ember js java script framework
Ember js java script framework
sara stanford
 
Introduction to ember js
Introduction to ember js
Adnan Arshad
 
Ember.js 101 - JSChannel NCR
Ember.js 101 - JSChannel NCR
Achal Aggarwal
 
Ember vs Backbone
Ember vs Backbone
Abdriy Mosin
 
Intro to ember.js
Intro to ember.js
Leo Hernandez
 
Emberjs and ASP.NET
Emberjs and ASP.NET
Mike Melusky
 
Ember.js Meetup Brussels 31/10/2013
Ember.js Meetup Brussels 31/10/2013
Hstry
 
Ember - introduction
Ember - introduction
Harikrishnan C
 
Modern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.js
Mike North
 
Ember,js: Hipster Hamster Framework
Ember,js: Hipster Hamster Framework
Billy Shih
 
Introduction to Ember.js
Introduction to Ember.js
Vinoth Kumar
 
Riding the Edge with Ember.js
Riding the Edge with Ember.js
aortbals
 
Introduction to Ember.js
Introduction to Ember.js
Jeremy Brown
 
A Beginner's Guide to Ember
A Beginner's Guide to Ember
Richard Martin
 
Intro to emberjs
Intro to emberjs
Mandy Pao
 
Getting into ember.js
Getting into ember.js
reybango
 
Parse Apps with Ember.js
Parse Apps with Ember.js
Matthew Beale
 
Ember presentation
Ember presentation
Daniel N
 
Ember js java script framework
Ember js java script framework
sara stanford
 
Introduction to ember js
Introduction to ember js
Adnan Arshad
 
Ember.js 101 - JSChannel NCR
Ember.js 101 - JSChannel NCR
Achal Aggarwal
 
Emberjs and ASP.NET
Emberjs and ASP.NET
Mike Melusky
 
Ember.js Meetup Brussels 31/10/2013
Ember.js Meetup Brussels 31/10/2013
Hstry
 
Modern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.js
Mike North
 
Ember,js: Hipster Hamster Framework
Ember,js: Hipster Hamster Framework
Billy Shih
 
Ad

Recently uploaded (20)

From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
Daily Lesson Log MATATAG ICT TEchnology 8
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Cyber Defense Matrix Workshop - RSA Conference
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
Daily Lesson Log MATATAG ICT TEchnology 8
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 

Create an application with ember

  • 1. Ember Build an ambitious application By : Chandrasekar.G
  • 2. What is Ember ? Ember is an open source javascript framework. Collection of libraries that are written in pure MVC architectural pattern.
  • 3. Why Ember ? Avoid boilerplate codes . Creates a standard application architecture . Designed and developed to create and manage large web applications. Dynamic data bindings. Ember follows pure MVC Architectural pattern that
 Improves application testability .
 Keeps application codes modular.
  • 4. Previous development In a Software Application , User interface get change often more than logics and data. Application might be have several parts / state ,So each state of application may have different layout , data displaying styles. So each time user navigate these things are get shuffle when application state change. In the previous programming development business logics and presentation logics are tightly coupled in the codes of JSP and JS files . Disadvantages
  • 5. New development In the new development data logics , business logics and presentation logics are get separated with modular programming pattern. One the main benefit of the decoupling is application will have ability to develop an independent presentation application .
  • 6. Architectural pattern Architectural pattern is a solution to solve design problem . Architectural pattern which gives the clear pictures about application system. It describes the subsystems and components of the application and relation between them. In software world which used to address different kind of issues such as :-
 Performance 
 Security
  • 7. Architectural patterns Model - View - Controller Model - View - Adapter Model - View - View Model Some list of architectural patterns which used in software applications.
  • 8. MVC Overview Model
 The model component covers the list application parts :-
 Data.
 Set of rules to store data in structure. 
 Logics and functions. View
 View component represents the model in different types such as 
 Chart 
 Pivot 
 User customised view Controller
 The Controller component behaves like a mediator which sends the commands to 
 View and Model. MVC software design pattern has divided as three components Model, View Controller.
  • 9. MVC Good Explanation This explanation found on stackoverflow.com. View : "Hey, controller, the user just told me he wants item 4 deleted." Controller : "Hmm, having checked his credentials, he is allowed to do that... 
 Hey, model, I want you to get item 4 and do whatever you do to delete it." Model : "Item 4... got it. It's deleted. Back to you, Controller." Controller : "Here, I'll collect the new set of data. Back to you, view." View : "Cool, I'll show the new set to the user now."
 
 
 By : Andres Jaan Tack
  • 10. Software design layer Book for special offer Name Contact Address Submit Cancel ViewModel Controller Reset Form Update Form Cancel
  • 11. Starting with Ember Requirements 
 jquery.js
 ember.js
 handlebars.js
 ember-data.js
  • 12. Understanding Ember Template
 In Ember, Template concept is used to define user interface of the application Router
 Router is an Ember class which manages the application state . View / Components 
 View class is responsible for data binding with support of templates.
 One more option which provides that developer can implement DOM events for the user interactions . Model
 Model is a class that defines properties , structure and behaviour of the data. Controller
 Ember controllers usually consist the code to execute the tasks. Core concept of Ember
  • 13. Template Template is basically a rear surface of model or presentation. One of the advantage of using template library is when the model get change template also get change automatically. Template engines are written in UI data binding software design pattern. Ember supports handlebars template engine by default , though which provides flexibility to use other templates engine such emblem and etc… . Dynamic UI data binding Some example Client side template engines 
 Emblem
 Underscore JS template 
 Mustache JS
 EJS
 Dust JS

  • 14. Handlebars Handlebars JS takes the given HTML string and It’s own language syntax codes and compiles them to the javascript method. Handlebars JS is an extension of Mustache JS template engine and developed to supersede mustache JS. Logic-less template engine.
  • 15. Using handlebars JS Defining simple handlebar template <script id=“template” type=“text/x-handlebars”> Welcome, <b> {{user.name}} </b> </script > “ {{ }} ” expression represents template 
 model data as HTML Example : Simple handlebar template <script> var context = { user : { name : "Jack Sparrow"} } var templatecontent = $("#template").html();
 var template = Handlebars.compile(templatecontent); $('body').append(template(context)); </script> Getting template by ID Compiler makes template function Passing the data as parameter in the template function
  • 16. Handlebars Helpers Block Helpers
 Handlebars JS provide predefined block level expressions such as conditional
 statements and loops. Custom Helper
 Handlebars JS allows developer to create their own helper with option of resister helper Actions Helpers
 Handlebars actions helpers are mainly implemented to handle DOM events. 
 Actions related codes will be maintain in the controllers. View Helper
 View helper is used to define template with help of view class .. will be cover on ember view Template Helpers
 There are three expression “ template “, “ partial ” and “render” which are used to includes 
 specific template in the context . Outlet
 Outlet helper tells to render the route related template and allows to render child templates. Handlebars JS has some expressions for dynamic data binding
  • 17. Using Block helpers
 <div class={{#if alreadyVisited}} "alreadyVisited"{{/if}} "notVisited"> {{name}} </div> Example : Conditional statements Conditional statements If, else, unless Each {{#each bookmarks}} ! {{/each}} <div class="visitedUsers"> <br> <b> Visited user</b> : {{#unless visitedUser.length}} No one visited yet this site {{else}} {{visitedUser}} {{/unless}} </div> Note : Else if conditions are not supported Example : Each in Handlebar
  • 18. with with is a block helper which helps to change the context of the template . Example : "with" Block helper {{#with otherActivities}} {{sports}} <br> {{music}} {{/with}} Custom Helpers Handlebars.registerHelper("createController", function (string){ return string+"Controller = Em.Controller.extend({})"; }); Example : Custom Block helper Following below codes will create a new helper called creteController 
 so developer can use In that template
  • 19. Ember Application var App = Em.Application.create(); Creating Application Following code will create the instance of ember application. Application provides some default package of components. ! We can implement application view with the help of handlebar like following code ! <script type=“text/x-handlebars” > HTML code goes here </script> ! If we don’t mention any ID in It will render the application view . Basically It makes the body element as ember application .Instead of body element We can specify the Application view element with option of rootElement. var App = Em.Application.create({ rootElement : “main” });
  • 20. Debug configuration LOG_STACKTRACE_ON_DEPRECATION : true, LOG_BINDINGS : true, LOG_TRANSITIONS : true, LOG_TRANSITIONS_INTERNAL : true, LOG_VIEW_LOOKUPS : true, LOG_ACTIVE_GENERATION : true {{debugger}} Following code will throw the error in template Get logs of specified layer {{log controller}} List of properties are available for logging
  • 21. Router Ember router class store the application state in browser’s URL. Ember creates router object on application loads named App.Router. Routes classes are generates with ember UpperCamelCase convention. Application router comes by default with the set of route objects called IndexRoute and ApplicationRoute. ApplicationRoute will load in the all resource by default.
  • 22. Router in Action App.Router.map(function(){}); App.Router loads IndexRouter and ApplicationRoute We can create routes with the option of “resource” and “route”. 
 We can override IndexRouter and ApplicationRouter to make more functionality to the application.
 App.IndexRoute = Em.Route.extend({ init : function() { console.log("Index Route loading "); } }); App.ApplicationRoute = Em.Route.extend({ init : function() { console.log("Application Route loading "); } });
  • 23. Defining Route App.Router.map(function(){ this.resource("users"); this.resource(“user",{path:"users/:id"}); }); This code will create users route This code will create dynamic segments Example : Route and Dynamic route So the generated routes are would be UsersRoute, UserRoute , So the application states are would be access through the URL 
 
 1. http://app/users/ 2. http://app/users/ 1
  • 25. View On Application load ember creates Application view and parallel application template by default.
 Creating View App.CustomView = Em.View.extend({ classNames: [‘customView'] tagName : “span” click : function (){ } }); This code will create View class instance {{#view App.CustomView}} Custom View {{/view}} Rendering template view helper Example : Defining view
  • 26. Ember Application view lifecycle Application Views Container Ember -Handlebar Handlebar compiler Metamorph <script > handlebars Renders HTML
  • 27. Model Defining Ember model App.Info = DS.Model.extend({}); This code will create the model instance Defining attributes App.Info = DS.Model.extend({
 name : DS.attr('string'), version : DS.attr('number'), author : DS.attr('string'),
 hasReleased : DS.attr(‘boolean’ , {defaultValue: false})
 }); Defining data key and It’s type Setting default Example : Example model
  • 28. Controller Ember JS controllers provides developer to write and present data with display logics . Defining action using controller 28 App.PipeController = Em.Controller.extend({ title : "Manage your pipes", actions : { pipeNow : function (){ console.log("You can pipe now ",this.get('pipeNow')); } }, }); Here the logic codes go Example : Example of Controller action