SlideShare a Scribd company logo
Raúl Delgado & Andrés Lamilla
Front End Workshops
EmberJS General Overview
rdelgado@visual-engin.com
alamilla@visual-engin.com
A framework for creating ambitious
web applications.
● Focus on ambitious web applications: applications that look and act
like desktop applications, but happen to be delivered via web
technologies
● More productive out of the box: provide a complete development
stack to make the developer productive immediately. (Ember CLI,
application structure, thousands addons).
● Stability without stagnation: backward compatibility is important and
can be maintained while still innovating and evolving the framework.
● Future web standards foresight: pioneer of many standards around
Javascript and the web. (promises, web components and ES6 syntax)
Philosophy
● Routes: the state of an application is represented by a URL
● Models: data associated with the current state of the application
● Templates: HTMLBars templating language. (Handlebars
variation)
● Components: custom HTML tag
● Services: singleton objects to hold long-lived data such as user
sessions
Five essential Concepts
Big Picture
● In December 2011, the SproutCore 2.0 framework was renamed to Ember.js
● The framework was created by Yehuda Katz, a member of the jQuery, Ruby
on Rails and SproutCore core teams
● Ember follows a six-week release cycle. Every six weeks a new release is
made available, and at the same time a beta for the next release is also
published
● Ember follows the semantic versioning convention. This means that breaking
changes are only introduced at major version numbers such as 1.0, 2.0 etc.
● Ember 2.0 was released August 13, 2015. Introduction of the Glimmer
rendering engine
● It follows the Convention over configuration design paradigm
● Stable release 2.4.3 / March 17, 2016
Facts
Ember cli
● Strong conventional project structure
● Powerful addon system for extension
● Uses babel, which turns ES2015 module syntax into AMD (RequireJS-esq)
modules.
● Use QUnit and Ember QUnit by default. But, you are free to use other options
such as Mocha and Ember Mocha.
● Use Bower, for front-end dependencies and npm, for managing internal
dependencies
● Is configurable via a file named .ember-cli
Ember cli
Has support for:
● Handlebars
● HTMLBars
● Emblem
● LESS
● Sass
● Compass
● Stylus
● CoffeeScript
● EmberScript
● Minified JS & CSS
Ember cli
Commands:
● ember
● ember new <app-name>
● ember init
● ember build
● ember server
● ember generate <generator-name> <options>
● ember help generate
● ember destroy <generator-name> <options>
● ember test
● ember install <addon-name>
Ember cli
npm install -g ember-cli@2.4
ember new ember-quickstart
cd ember-quickstart
ember serve
Livereload server on http://localhost:49152
Serving on http://localhost:4200/
ember generate route scientists
installing route
create app/routes/scientists.js
create app/templates/scientists.hbs
updating router
add route scientists
installing route-test
create tests/unit/routes/scientists-test.js
ember build --env production
Ember cli
ember install ember-cli-sass
ember install ember-cli-bootstrap-sassy
mv app/styles/app.css app/styles/app.scss
echo '@import "bootstrap";' > app/styles/app.scss
Ember cli
Ember.object
Ember implements its own object system. The base object is Ember.Object.
All of the other objects in Ember extend Ember.Object.
Ember.Object can observe properties change.
This simple architectural decision is responsible for much of the consistency
across Ember. Every Ember object can observe the properties of other
objects, bind their properties to the properties of other objects, specify and
update computed properties, and much more.
This gives enormous power and flexibility !
Ember.object
Ember.object vs JS object
Defining new Ember Class:
Ember.object
Properties:
person1 = Person.extend({
firstName: “John”,
lastName: “McClaine”,
fullName(): {
let fullName = this.firstName + ‘ ’ + this.lastName;
alert(`my name is ${fullName} !`)
}
})
person1.get(‘firstName’) //John
person1.get(‘lastName’) //McClane
person1.fullName()
//my name is John Mclane !
Person = Ember.Object.extend()
user = Person.create()
Observers:
Ember.object
Person = Ember.Object.extend({
firstName: null,
lastName: null,
fullName: Ember.computed( 'firstName', 'lastName', function() {
return `${this.get('firstName')} ${this.get('lastName')}`;
}),
fullNameChanged: Ember.observer( 'fullName', () => {
// deal with the change
console.log(`fullName changed to: ${this.get('fullName')}`);
})
})
var person = Person.create({
firstName : Harry,
lastName : ‘Stamper’
})
person.get(‘fullName’) // Harry Stamper
person.set(‘firstName’, “Grace”)
// fullName changet to: Grace Stamper
Models
The models are objects that represent the underlying data that the application
presents the user. Different applications have very different models,
depending on what are the problems they are trying to solve.
You can create a model with the command:
This will generate:
Models
$ ember generate model person
Models
Defining attributes:
To define attributes to our model, we have four methods:
- Attr
- hasMany
- belonsTo
- normalizeModelName
attr:
Models
Relationship methods: hasMany & belongsTo:
One-to-one:
One-to-many:
Many-to-many:
Routing
Ember is URL-driven so it always starts in the
URL. In the example, our router has the
following definition:
Routing
An instance of the Route invoke the model() method where we turn the model.
Here it looks like a dummy object is returned:
Once model() has been returned, the
renderComponent() method call
ItemDisplayComponent model.
Not only push data paths. They can also
receive actions.
Actions are sent from components or other
routes, so that the logic transitions involving
URL or another route-level issue.
Routing
Routing
What’s going on here?
1. The Router parses the /items/2 URL and dispatches
control to a matching route: ItemRoute with a
parameter item_id=2
2. ItemRoute invokes its model() hook, in which our
app returns a model (Item with id=2) fetched via a
service
3. renderComponent() is then run to render the
component ItemDisplayComponent, passing it the
resolved model Item
4. ItemDisplayComponent is responsible for the user
interface: rendering/updating the DOM, and handling
browser events
The application route is entered when your app first boots up. Like other routes, it will load a
template with the same name (application in this case) by default. You should put your header,
footer, and any other decorative content here. All other routes will render their templates into the
application.hbs template's {{outlet}}.
This route is part of every application, so you don't need to specify it in your app/router.js.
Routing
The application route:
Index Routes:
At every level of nesting (including the top level),
Ember automatically provides a route for the /
path named index.
Templates
app/helpers/sum.js
export function sum(params) {
return params.reduce((a, b) => {
return a + b;
});
};
export default Ember.Helper.helper(sum);
Templates
<p>Total: {{sum 1 2 3}}</p>
{{sum (multiply 2 4) 2}}
<div>
{{if isFast "I am fast" "I am slow"}}
</div>
Templates
<div>
{{if isFast (if isFueled "zoooom")}}
</div>
{{#if isAtWork}}
Ship that code!
{{else if isReading}}
You can finish War and Peace eventually...
{{/if}}
{{#each people as |person|}}
Hello, {{person.name}}!
{{else}}
Sorry, nobody is here.
{{/each}}
Templates
<ul>
{{#each people as |person index|}}
<li>Hello, {{person.name}}! You're number {{index}} in line</li>
{{/each}}
</ul>
/app/components/store-categories.js
export default Ember.Component.extend({
willRender() {
this.set('categories', {
'Bourbons': ['Bulleit', 'Four Roses', 'Woodford Reserve'],
'Ryes': ['WhistlePig', 'High West']
});
}
});
Templates
/app/templates/components/store-categories.hbs
<ul>
{{#each-in categories as |category products|}}
<li>{{category}}
<ol>
{{#each products as |product|}}
<li>{{product}}</li>
{{/each}}
</ol>
</li>
{{/each-in}}
</ul>
<ul>
<li>Bourbons
<ol>
<li>Bulleit</li>
<li>Four Roses</li>
<li>Woodford Reserve</li>
</ol>
</li>
<li>Ryes
<ol>
<li>WhistlePig</li>
<li>High West</li>
</ol>
</li>
</ul>
/app/components/store-categories.js
export default Ember.Component.extend({
willRender() {
this.set('categories', {
'Bourbons': ['Bulleit', 'Four Roses', 'Woodford Reserve'],
'Ryes': ['WhistlePig', 'High West']
});
},
actions: {
addCategory(category) {
let categories = this.get('categories');
categories[category] = [ ];
// A manual re-render causes the DOM to be updated
this.rerender();
}
}
});
Templates
app/templates/components/single-post.hbs
<p><button {{action "select" post}}>✓</button> {{post.title}}</p>
Templates
app/components/single-post.js
export default Ember.Component.extend({
actions: {
select(post) {
console.log(post.get('title'));
}
}
});
app/templates/components/single-post.hbs
<p>
<button {{action "select" post on="mouseUp"}}>✓</button>
{{post.title}}
</p>
Components
ember generate component my-component-name
installing component
create app/components/my-component-name.js
create app/templates/components/my-component-name.hbs
installing component-test
create tests/integration/components/my-component-name-test.js
Components
app/templates/components/blog-post.hbs
<article class="blog-post">
<h1>{{title}}</h1>
<p>{{yield}}</p>
<p>Edit title: {{input type="text" value=title}}</p>
</article>
app/templates/index.hbs
{{#each model as |post|}}
{{#blog-post title=post.title}}
{{post.body}}
{{/blog-post}}
{{/each}}
app/routes/index.js
export default Ember.Route.extend({
model() {
return this.store.findAll('post');
}
});
https://ember-twiddle.com/7ff20a68a367df12a894294d837bc391?openFiles=controllers.application.js%2Cblog-post.template.
hbs
Controllers
A controller is a routable object meant to “decorate” a model with display
logic.
Controllers
A controller is a routable object meant to “decorate” a model with display
logic.
Controllers
Ember CLI Mirage
Mirage
Ember CLI Mirage is a client side mock server to develop and prototype
applications.
Fixtures and Factories
We now have a couple of choices. We can create data using fixtures, or
generate them through a factory. It's probably a good idea to use factories.
They can easily be added to your tests.
Fixtures
Mirage
Factories
More information in...
● https://guides.emberjs.com/v2.4.0/
● http://emberjs.com/api/
● https://ember-twiddle.com/
● http://emberigniter.com/
● http://yoember.com/
Workshop 16: EmberJS Parte I
Ad

More Related Content

What's hot (20)

Angularjs architecture
Angularjs architectureAngularjs architecture
Angularjs architecture
Michael He
 
Workshop 21: React Router
Workshop 21: React RouterWorkshop 21: React Router
Workshop 21: React Router
Visual Engineering
 
Angularjs
AngularjsAngularjs
Angularjs
Vincenzo Ferrari
 
Angular js
Angular jsAngular js
Angular js
Manav Prasad
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
Jussi Pohjolainen
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
Building a Startup Stack with AngularJS
Building a Startup Stack with AngularJSBuilding a Startup Stack with AngularJS
Building a Startup Stack with AngularJS
FITC
 
AngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UXAngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UX
JWORKS powered by Ordina
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Angularjs - lazy loading techniques
Angularjs - lazy loading techniques
Nir Kaufman
 
AngularJS Best Practices
AngularJS Best PracticesAngularJS Best Practices
AngularJS Best Practices
Narek Mamikonyan
 
Angular Lazy Loading and Resolve (Route Resolver)
Angular Lazy Loading and Resolve (Route Resolver)Angular Lazy Loading and Resolve (Route Resolver)
Angular Lazy Loading and Resolve (Route Resolver)
Squash Apps Pvt Ltd
 
Advanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSAdvanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
Introduction to Angularjs
Introduction to AngularjsIntroduction to Angularjs
Introduction to Angularjs
Manish Shekhawat
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
Tania Gonzales
 
The AngularJS way
The AngularJS wayThe AngularJS way
The AngularJS way
Boyan Mihaylov
 
AngularJS for Java Developers
AngularJS for Java DevelopersAngularJS for Java Developers
AngularJS for Java Developers
Loc Nguyen
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
Kai Koenig
 
AngularJS Basic Training
AngularJS Basic TrainingAngularJS Basic Training
AngularJS Basic Training
Cornel Stefanache
 
Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - Introduction
Sagar Acharya
 
Angularjs architecture
Angularjs architectureAngularjs architecture
Angularjs architecture
Michael He
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
Stéphane Bégaudeau
 
Building a Startup Stack with AngularJS
Building a Startup Stack with AngularJSBuilding a Startup Stack with AngularJS
Building a Startup Stack with AngularJS
FITC
 
AngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UXAngularJS Basics and Best Practices - CC FE &UX
AngularJS Basics and Best Practices - CC FE &UX
JWORKS powered by Ordina
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
Gary Arora
 
Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Angularjs - lazy loading techniques
Angularjs - lazy loading techniques
Nir Kaufman
 
Angular Lazy Loading and Resolve (Route Resolver)
Angular Lazy Loading and Resolve (Route Resolver)Angular Lazy Loading and Resolve (Route Resolver)
Angular Lazy Loading and Resolve (Route Resolver)
Squash Apps Pvt Ltd
 
Advanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JSAdvanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JS
Simon Guest
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
Tania Gonzales
 
AngularJS for Java Developers
AngularJS for Java DevelopersAngularJS for Java Developers
AngularJS for Java Developers
Loc Nguyen
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
Kai Koenig
 
Angular JS - Introduction
Angular JS - IntroductionAngular JS - Introduction
Angular JS - Introduction
Sagar Acharya
 

Viewers also liked (20)

Change document display
Change document displayChange document display
Change document display
Radosław Gref
 
Workshop iOS 3: Testing, protocolos y extensiones
Workshop iOS 3: Testing, protocolos y extensionesWorkshop iOS 3: Testing, protocolos y extensiones
Workshop iOS 3: Testing, protocolos y extensiones
Visual Engineering
 
Unlock The Value Of Your Microsoft and SAP Investments
Unlock The Value Of Your Microsoft and SAP InvestmentsUnlock The Value Of Your Microsoft and SAP Investments
Unlock The Value Of Your Microsoft and SAP Investments
SAP Technology
 
CDS Unit Testing
CDS Unit TestingCDS Unit Testing
CDS Unit Testing
ChrisESwanepoel
 
Workshop iOS 4: Closures, generics & operators
Workshop iOS 4: Closures, generics & operatorsWorkshop iOS 4: Closures, generics & operators
Workshop iOS 4: Closures, generics & operators
Visual Engineering
 
Workshop 11: Trendy web designs & prototyping
Workshop 11: Trendy web designs & prototypingWorkshop 11: Trendy web designs & prototyping
Workshop 11: Trendy web designs & prototyping
Visual Engineering
 
Multithreading 101
Multithreading 101Multithreading 101
Multithreading 101
Tim Penhey
 
Hana sql
Hana sql Hana sql
Hana sql
Manuel Zárate
 
JavaScript for ABAP Programmers - 7/7 Functional Programming
JavaScript for ABAP Programmers - 7/7 Functional ProgrammingJavaScript for ABAP Programmers - 7/7 Functional Programming
JavaScript for ABAP Programmers - 7/7 Functional Programming
Chris Whealy
 
Workshop 24: React Native Introduction
Workshop 24: React Native IntroductionWorkshop 24: React Native Introduction
Workshop 24: React Native Introduction
Visual Engineering
 
Automated Testing Of Web Applications Using XML
Automated  Testing Of  Web  Applications Using  XMLAutomated  Testing Of  Web  Applications Using  XML
Automated Testing Of Web Applications Using XML
diongillard
 
Getting Started with OpenUI5 (San Francisco State University)
Getting Started with OpenUI5 (San Francisco State University)Getting Started with OpenUI5 (San Francisco State University)
Getting Started with OpenUI5 (San Francisco State University)
Alexander Graebe
 
Python Intro
Python IntroPython Intro
Python Intro
Tim Penhey
 
SAP for Utilities 2015 FINAL HOTLIST
SAP for Utilities 2015 FINAL HOTLISTSAP for Utilities 2015 FINAL HOTLIST
SAP for Utilities 2015 FINAL HOTLIST
Jonathan Toomey
 
Introduction to Design Thinking
Introduction to Design ThinkingIntroduction to Design Thinking
Introduction to Design Thinking
Blackvard
 
Workhop iOS 1: Fundamentos de Swift
Workhop iOS 1: Fundamentos de SwiftWorkhop iOS 1: Fundamentos de Swift
Workhop iOS 1: Fundamentos de Swift
Visual Engineering
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
Visual Engineering
 
Consuming Data With HANA XS
Consuming Data With HANA XSConsuming Data With HANA XS
Consuming Data With HANA XS
Blackvard
 
OpenUI5
OpenUI5OpenUI5
OpenUI5
Vitaliy Rudnytskiy
 
Workshop 25: React Native - Components
Workshop 25: React Native - ComponentsWorkshop 25: React Native - Components
Workshop 25: React Native - Components
Visual Engineering
 
Change document display
Change document displayChange document display
Change document display
Radosław Gref
 
Workshop iOS 3: Testing, protocolos y extensiones
Workshop iOS 3: Testing, protocolos y extensionesWorkshop iOS 3: Testing, protocolos y extensiones
Workshop iOS 3: Testing, protocolos y extensiones
Visual Engineering
 
Unlock The Value Of Your Microsoft and SAP Investments
Unlock The Value Of Your Microsoft and SAP InvestmentsUnlock The Value Of Your Microsoft and SAP Investments
Unlock The Value Of Your Microsoft and SAP Investments
SAP Technology
 
Workshop iOS 4: Closures, generics & operators
Workshop iOS 4: Closures, generics & operatorsWorkshop iOS 4: Closures, generics & operators
Workshop iOS 4: Closures, generics & operators
Visual Engineering
 
Workshop 11: Trendy web designs & prototyping
Workshop 11: Trendy web designs & prototypingWorkshop 11: Trendy web designs & prototyping
Workshop 11: Trendy web designs & prototyping
Visual Engineering
 
Multithreading 101
Multithreading 101Multithreading 101
Multithreading 101
Tim Penhey
 
JavaScript for ABAP Programmers - 7/7 Functional Programming
JavaScript for ABAP Programmers - 7/7 Functional ProgrammingJavaScript for ABAP Programmers - 7/7 Functional Programming
JavaScript for ABAP Programmers - 7/7 Functional Programming
Chris Whealy
 
Workshop 24: React Native Introduction
Workshop 24: React Native IntroductionWorkshop 24: React Native Introduction
Workshop 24: React Native Introduction
Visual Engineering
 
Automated Testing Of Web Applications Using XML
Automated  Testing Of  Web  Applications Using  XMLAutomated  Testing Of  Web  Applications Using  XML
Automated Testing Of Web Applications Using XML
diongillard
 
Getting Started with OpenUI5 (San Francisco State University)
Getting Started with OpenUI5 (San Francisco State University)Getting Started with OpenUI5 (San Francisco State University)
Getting Started with OpenUI5 (San Francisco State University)
Alexander Graebe
 
SAP for Utilities 2015 FINAL HOTLIST
SAP for Utilities 2015 FINAL HOTLISTSAP for Utilities 2015 FINAL HOTLIST
SAP for Utilities 2015 FINAL HOTLIST
Jonathan Toomey
 
Introduction to Design Thinking
Introduction to Design ThinkingIntroduction to Design Thinking
Introduction to Design Thinking
Blackvard
 
Workhop iOS 1: Fundamentos de Swift
Workhop iOS 1: Fundamentos de SwiftWorkhop iOS 1: Fundamentos de Swift
Workhop iOS 1: Fundamentos de Swift
Visual Engineering
 
Workshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte IWorkshop 12: AngularJS Parte I
Workshop 12: AngularJS Parte I
Visual Engineering
 
Consuming Data With HANA XS
Consuming Data With HANA XSConsuming Data With HANA XS
Consuming Data With HANA XS
Blackvard
 
Workshop 25: React Native - Components
Workshop 25: React Native - ComponentsWorkshop 25: React Native - Components
Workshop 25: React Native - Components
Visual Engineering
 
Ad

Similar to Workshop 16: EmberJS Parte I (20)

Phoenix for Rails Devs
Phoenix for Rails DevsPhoenix for Rails Devs
Phoenix for Rails Devs
Diacode
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
Rory Gianni
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 
Introduction to ember js
Introduction to ember jsIntroduction to ember js
Introduction to ember js
Adnan Arshad
 
Introduction to Ember.js
Introduction to Ember.jsIntroduction to Ember.js
Introduction to Ember.js
Vinoth Kumar
 
express.js.pptxgghhhhhhnnbvcdssazxvuyiknvc
express.js.pptxgghhhhhhnnbvcdssazxvuyiknvcexpress.js.pptxgghhhhhhnnbvcdssazxvuyiknvc
express.js.pptxgghhhhhhnnbvcdssazxvuyiknvc
rani marri
 
Workshop 17: EmberJS parte II
Workshop 17: EmberJS parte IIWorkshop 17: EmberJS parte II
Workshop 17: EmberJS parte II
Visual Engineering
 
Full slidescr16
Full slidescr16Full slidescr16
Full slidescr16
Lucio Grenzi
 
The road to Ember.js 2.0
The road to Ember.js 2.0The road to Ember.js 2.0
The road to Ember.js 2.0
Codemotion
 
GHC
GHCGHC
GHC
AidIQ
 
Create an application with ember
Create an application with ember Create an application with ember
Create an application with ember
Chandra Sekar
 
JavaScript Modules Done Right
JavaScript Modules Done RightJavaScript Modules Done Right
JavaScript Modules Done Right
Mariusz Nowak
 
IOC + Javascript
IOC + JavascriptIOC + Javascript
IOC + Javascript
Brian Cavalier
 
Building Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSBuilding Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJS
Antonio Peric-Mazar
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteor
Sapna Upreti
 
Intro to EmberJS
Intro to EmberJSIntro to EmberJS
Intro to EmberJS
Billy Onjea
 
RequireJS
RequireJSRequireJS
RequireJS
Tim Doherty
 
Nodejs.meetup
Nodejs.meetupNodejs.meetup
Nodejs.meetup
Vivian S. Zhang
 
Build Web Apps using Node.js
Build Web Apps using Node.jsBuild Web Apps using Node.js
Build Web Apps using Node.js
davidchubbs
 
SproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsSproutCore and the Future of Web Apps
SproutCore and the Future of Web Apps
Mike Subelsky
 
Phoenix for Rails Devs
Phoenix for Rails DevsPhoenix for Rails Devs
Phoenix for Rails Devs
Diacode
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
Rory Gianni
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 
Introduction to ember js
Introduction to ember jsIntroduction to ember js
Introduction to ember js
Adnan Arshad
 
Introduction to Ember.js
Introduction to Ember.jsIntroduction to Ember.js
Introduction to Ember.js
Vinoth Kumar
 
express.js.pptxgghhhhhhnnbvcdssazxvuyiknvc
express.js.pptxgghhhhhhnnbvcdssazxvuyiknvcexpress.js.pptxgghhhhhhnnbvcdssazxvuyiknvc
express.js.pptxgghhhhhhnnbvcdssazxvuyiknvc
rani marri
 
The road to Ember.js 2.0
The road to Ember.js 2.0The road to Ember.js 2.0
The road to Ember.js 2.0
Codemotion
 
Create an application with ember
Create an application with ember Create an application with ember
Create an application with ember
Chandra Sekar
 
JavaScript Modules Done Right
JavaScript Modules Done RightJavaScript Modules Done Right
JavaScript Modules Done Right
Mariusz Nowak
 
Building Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSBuilding Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJS
Antonio Peric-Mazar
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteor
Sapna Upreti
 
Intro to EmberJS
Intro to EmberJSIntro to EmberJS
Intro to EmberJS
Billy Onjea
 
Build Web Apps using Node.js
Build Web Apps using Node.jsBuild Web Apps using Node.js
Build Web Apps using Node.js
davidchubbs
 
SproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsSproutCore and the Future of Web Apps
SproutCore and the Future of Web Apps
Mike Subelsky
 
Ad

More from Visual Engineering (18)

Workshop iOS 2: Swift - Structures
Workshop iOS 2: Swift - StructuresWorkshop iOS 2: Swift - Structures
Workshop iOS 2: Swift - Structures
Visual Engineering
 
Workshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideWorkshop 26: React Native - The Native Side
Workshop 26: React Native - The Native Side
Visual Engineering
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testing
Visual Engineering
 
Workshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux AdvancedWorkshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux Advanced
Visual Engineering
 
Workshop 22: React-Redux Middleware
Workshop 22: React-Redux MiddlewareWorkshop 22: React-Redux Middleware
Workshop 22: React-Redux Middleware
Visual Engineering
 
Workshop 20: ReactJS Part II Flux Pattern & Redux
Workshop 20: ReactJS Part II Flux Pattern & ReduxWorkshop 20: ReactJS Part II Flux Pattern & Redux
Workshop 20: ReactJS Part II Flux Pattern & Redux
Visual Engineering
 
Workshop 19: ReactJS Introduction
Workshop 19: ReactJS IntroductionWorkshop 19: ReactJS Introduction
Workshop 19: ReactJS Introduction
Visual Engineering
 
Workshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsWorkshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effects
Visual Engineering
 
Workshop 15: Ionic framework
Workshop 15: Ionic frameworkWorkshop 15: Ionic framework
Workshop 15: Ionic framework
Visual Engineering
 
Workshop 14: AngularJS Parte III
Workshop 14: AngularJS Parte IIIWorkshop 14: AngularJS Parte III
Workshop 14: AngularJS Parte III
Visual Engineering
 
Workshop 13: AngularJS Parte II
Workshop 13: AngularJS Parte IIWorkshop 13: AngularJS Parte II
Workshop 13: AngularJS Parte II
Visual Engineering
 
Workshop 8: Templating: Handlebars, DustJS
Workshop 8: Templating: Handlebars, DustJSWorkshop 8: Templating: Handlebars, DustJS
Workshop 8: Templating: Handlebars, DustJS
Visual Engineering
 
Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6
Visual Engineering
 
Workshop 7: Single Page Applications
Workshop 7: Single Page ApplicationsWorkshop 7: Single Page Applications
Workshop 7: Single Page Applications
Visual Engineering
 
Workshop 6: Designer tools
Workshop 6: Designer toolsWorkshop 6: Designer tools
Workshop 6: Designer tools
Visual Engineering
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
Visual Engineering
 
Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.
Visual Engineering
 
Workshop 3: JavaScript build tools
Workshop 3: JavaScript build toolsWorkshop 3: JavaScript build tools
Workshop 3: JavaScript build tools
Visual Engineering
 
Workshop iOS 2: Swift - Structures
Workshop iOS 2: Swift - StructuresWorkshop iOS 2: Swift - Structures
Workshop iOS 2: Swift - Structures
Visual Engineering
 
Workshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideWorkshop 26: React Native - The Native Side
Workshop 26: React Native - The Native Side
Visual Engineering
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testing
Visual Engineering
 
Workshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux AdvancedWorkshop 22: ReactJS Redux Advanced
Workshop 22: ReactJS Redux Advanced
Visual Engineering
 
Workshop 22: React-Redux Middleware
Workshop 22: React-Redux MiddlewareWorkshop 22: React-Redux Middleware
Workshop 22: React-Redux Middleware
Visual Engineering
 
Workshop 20: ReactJS Part II Flux Pattern & Redux
Workshop 20: ReactJS Part II Flux Pattern & ReduxWorkshop 20: ReactJS Part II Flux Pattern & Redux
Workshop 20: ReactJS Part II Flux Pattern & Redux
Visual Engineering
 
Workshop 19: ReactJS Introduction
Workshop 19: ReactJS IntroductionWorkshop 19: ReactJS Introduction
Workshop 19: ReactJS Introduction
Visual Engineering
 
Workshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effectsWorkshop 18: CSS Animations & cool effects
Workshop 18: CSS Animations & cool effects
Visual Engineering
 
Workshop 14: AngularJS Parte III
Workshop 14: AngularJS Parte IIIWorkshop 14: AngularJS Parte III
Workshop 14: AngularJS Parte III
Visual Engineering
 
Workshop 13: AngularJS Parte II
Workshop 13: AngularJS Parte IIWorkshop 13: AngularJS Parte II
Workshop 13: AngularJS Parte II
Visual Engineering
 
Workshop 8: Templating: Handlebars, DustJS
Workshop 8: Templating: Handlebars, DustJSWorkshop 8: Templating: Handlebars, DustJS
Workshop 8: Templating: Handlebars, DustJS
Visual Engineering
 
Workshop 7: Single Page Applications
Workshop 7: Single Page ApplicationsWorkshop 7: Single Page Applications
Workshop 7: Single Page Applications
Visual Engineering
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
Visual Engineering
 
Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.
Visual Engineering
 
Workshop 3: JavaScript build tools
Workshop 3: JavaScript build toolsWorkshop 3: JavaScript build tools
Workshop 3: JavaScript build tools
Visual Engineering
 

Recently uploaded (20)

Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 

Workshop 16: EmberJS Parte I

  • 1. Raúl Delgado & Andrés Lamilla Front End Workshops EmberJS General Overview [email protected] [email protected]
  • 2. A framework for creating ambitious web applications.
  • 3. ● Focus on ambitious web applications: applications that look and act like desktop applications, but happen to be delivered via web technologies ● More productive out of the box: provide a complete development stack to make the developer productive immediately. (Ember CLI, application structure, thousands addons). ● Stability without stagnation: backward compatibility is important and can be maintained while still innovating and evolving the framework. ● Future web standards foresight: pioneer of many standards around Javascript and the web. (promises, web components and ES6 syntax) Philosophy
  • 4. ● Routes: the state of an application is represented by a URL ● Models: data associated with the current state of the application ● Templates: HTMLBars templating language. (Handlebars variation) ● Components: custom HTML tag ● Services: singleton objects to hold long-lived data such as user sessions Five essential Concepts
  • 6. ● In December 2011, the SproutCore 2.0 framework was renamed to Ember.js ● The framework was created by Yehuda Katz, a member of the jQuery, Ruby on Rails and SproutCore core teams ● Ember follows a six-week release cycle. Every six weeks a new release is made available, and at the same time a beta for the next release is also published ● Ember follows the semantic versioning convention. This means that breaking changes are only introduced at major version numbers such as 1.0, 2.0 etc. ● Ember 2.0 was released August 13, 2015. Introduction of the Glimmer rendering engine ● It follows the Convention over configuration design paradigm ● Stable release 2.4.3 / March 17, 2016 Facts
  • 8. ● Strong conventional project structure ● Powerful addon system for extension ● Uses babel, which turns ES2015 module syntax into AMD (RequireJS-esq) modules. ● Use QUnit and Ember QUnit by default. But, you are free to use other options such as Mocha and Ember Mocha. ● Use Bower, for front-end dependencies and npm, for managing internal dependencies ● Is configurable via a file named .ember-cli Ember cli
  • 9. Has support for: ● Handlebars ● HTMLBars ● Emblem ● LESS ● Sass ● Compass ● Stylus ● CoffeeScript ● EmberScript ● Minified JS & CSS Ember cli
  • 10. Commands: ● ember ● ember new <app-name> ● ember init ● ember build ● ember server ● ember generate <generator-name> <options> ● ember help generate ● ember destroy <generator-name> <options> ● ember test ● ember install <addon-name> Ember cli
  • 11. npm install -g [email protected] ember new ember-quickstart cd ember-quickstart ember serve Livereload server on http://localhost:49152 Serving on http://localhost:4200/ ember generate route scientists installing route create app/routes/scientists.js create app/templates/scientists.hbs updating router add route scientists installing route-test create tests/unit/routes/scientists-test.js ember build --env production Ember cli
  • 12. ember install ember-cli-sass ember install ember-cli-bootstrap-sassy mv app/styles/app.css app/styles/app.scss echo '@import "bootstrap";' > app/styles/app.scss Ember cli
  • 14. Ember implements its own object system. The base object is Ember.Object. All of the other objects in Ember extend Ember.Object. Ember.Object can observe properties change. This simple architectural decision is responsible for much of the consistency across Ember. Every Ember object can observe the properties of other objects, bind their properties to the properties of other objects, specify and update computed properties, and much more. This gives enormous power and flexibility ! Ember.object
  • 16. Defining new Ember Class: Ember.object Properties: person1 = Person.extend({ firstName: “John”, lastName: “McClaine”, fullName(): { let fullName = this.firstName + ‘ ’ + this.lastName; alert(`my name is ${fullName} !`) } }) person1.get(‘firstName’) //John person1.get(‘lastName’) //McClane person1.fullName() //my name is John Mclane ! Person = Ember.Object.extend() user = Person.create()
  • 17. Observers: Ember.object Person = Ember.Object.extend({ firstName: null, lastName: null, fullName: Ember.computed( 'firstName', 'lastName', function() { return `${this.get('firstName')} ${this.get('lastName')}`; }), fullNameChanged: Ember.observer( 'fullName', () => { // deal with the change console.log(`fullName changed to: ${this.get('fullName')}`); }) }) var person = Person.create({ firstName : Harry, lastName : ‘Stamper’ }) person.get(‘fullName’) // Harry Stamper person.set(‘firstName’, “Grace”) // fullName changet to: Grace Stamper
  • 19. The models are objects that represent the underlying data that the application presents the user. Different applications have very different models, depending on what are the problems they are trying to solve. You can create a model with the command: This will generate: Models $ ember generate model person
  • 20. Models Defining attributes: To define attributes to our model, we have four methods: - Attr - hasMany - belonsTo - normalizeModelName attr:
  • 21. Models Relationship methods: hasMany & belongsTo: One-to-one: One-to-many: Many-to-many:
  • 23. Ember is URL-driven so it always starts in the URL. In the example, our router has the following definition: Routing An instance of the Route invoke the model() method where we turn the model. Here it looks like a dummy object is returned: Once model() has been returned, the renderComponent() method call ItemDisplayComponent model.
  • 24. Not only push data paths. They can also receive actions. Actions are sent from components or other routes, so that the logic transitions involving URL or another route-level issue. Routing
  • 25. Routing What’s going on here? 1. The Router parses the /items/2 URL and dispatches control to a matching route: ItemRoute with a parameter item_id=2 2. ItemRoute invokes its model() hook, in which our app returns a model (Item with id=2) fetched via a service 3. renderComponent() is then run to render the component ItemDisplayComponent, passing it the resolved model Item 4. ItemDisplayComponent is responsible for the user interface: rendering/updating the DOM, and handling browser events
  • 26. The application route is entered when your app first boots up. Like other routes, it will load a template with the same name (application in this case) by default. You should put your header, footer, and any other decorative content here. All other routes will render their templates into the application.hbs template's {{outlet}}. This route is part of every application, so you don't need to specify it in your app/router.js. Routing The application route: Index Routes: At every level of nesting (including the top level), Ember automatically provides a route for the / path named index.
  • 28. app/helpers/sum.js export function sum(params) { return params.reduce((a, b) => { return a + b; }); }; export default Ember.Helper.helper(sum); Templates <p>Total: {{sum 1 2 3}}</p> {{sum (multiply 2 4) 2}}
  • 29. <div> {{if isFast "I am fast" "I am slow"}} </div> Templates <div> {{if isFast (if isFueled "zoooom")}} </div> {{#if isAtWork}} Ship that code! {{else if isReading}} You can finish War and Peace eventually... {{/if}}
  • 30. {{#each people as |person|}} Hello, {{person.name}}! {{else}} Sorry, nobody is here. {{/each}} Templates <ul> {{#each people as |person index|}} <li>Hello, {{person.name}}! You're number {{index}} in line</li> {{/each}} </ul>
  • 31. /app/components/store-categories.js export default Ember.Component.extend({ willRender() { this.set('categories', { 'Bourbons': ['Bulleit', 'Four Roses', 'Woodford Reserve'], 'Ryes': ['WhistlePig', 'High West'] }); } }); Templates /app/templates/components/store-categories.hbs <ul> {{#each-in categories as |category products|}} <li>{{category}} <ol> {{#each products as |product|}} <li>{{product}}</li> {{/each}} </ol> </li> {{/each-in}} </ul> <ul> <li>Bourbons <ol> <li>Bulleit</li> <li>Four Roses</li> <li>Woodford Reserve</li> </ol> </li> <li>Ryes <ol> <li>WhistlePig</li> <li>High West</li> </ol> </li> </ul>
  • 32. /app/components/store-categories.js export default Ember.Component.extend({ willRender() { this.set('categories', { 'Bourbons': ['Bulleit', 'Four Roses', 'Woodford Reserve'], 'Ryes': ['WhistlePig', 'High West'] }); }, actions: { addCategory(category) { let categories = this.get('categories'); categories[category] = [ ]; // A manual re-render causes the DOM to be updated this.rerender(); } } }); Templates
  • 33. app/templates/components/single-post.hbs <p><button {{action "select" post}}>✓</button> {{post.title}}</p> Templates app/components/single-post.js export default Ember.Component.extend({ actions: { select(post) { console.log(post.get('title')); } } }); app/templates/components/single-post.hbs <p> <button {{action "select" post on="mouseUp"}}>✓</button> {{post.title}} </p>
  • 35. ember generate component my-component-name installing component create app/components/my-component-name.js create app/templates/components/my-component-name.hbs installing component-test create tests/integration/components/my-component-name-test.js Components app/templates/components/blog-post.hbs <article class="blog-post"> <h1>{{title}}</h1> <p>{{yield}}</p> <p>Edit title: {{input type="text" value=title}}</p> </article> app/templates/index.hbs {{#each model as |post|}} {{#blog-post title=post.title}} {{post.body}} {{/blog-post}} {{/each}} app/routes/index.js export default Ember.Route.extend({ model() { return this.store.findAll('post'); } }); https://ember-twiddle.com/7ff20a68a367df12a894294d837bc391?openFiles=controllers.application.js%2Cblog-post.template. hbs
  • 37. A controller is a routable object meant to “decorate” a model with display logic. Controllers
  • 38. A controller is a routable object meant to “decorate” a model with display logic. Controllers
  • 40. Mirage Ember CLI Mirage is a client side mock server to develop and prototype applications. Fixtures and Factories We now have a couple of choices. We can create data using fixtures, or generate them through a factory. It's probably a good idea to use factories. They can easily be added to your tests.
  • 42. More information in... ● https://guides.emberjs.com/v2.4.0/ ● http://emberjs.com/api/ ● https://ember-twiddle.com/ ● http://emberigniter.com/ ● http://yoember.com/