SlideShare a Scribd company logo
1 of 30
Introduction to Ember.js
Ember Dallas - 18 Aug 2014
Jeremy Brown - notmessenger.com
What is Ember.js?
( besides awesome! )
Ember is…
• A framework for creating ambitious web applications
• Built for productivity
• Opinionated
• Sometimes perceived as difficult to learn
(Not to scale)
Core Concepts
• Models
• Routes
• Templates
• Views
• Controllers
• Components
Models
• An object that stores persistent state
• Templates are responsible for displaying the model to the
user by turning it into HTML
• In many applications, models are loaded via an HTTP
JSON API, although Ember is agnostic to the backend
that you choose
Routes
• URL representations of your application’s objects, telling
the template which model it should display (such as a url
of /cars renders a collection of cars)
• Queries the model and makes it available in the controller
and templates
• As the templates or models being shown to the user
change, Ember automatically keeps the URL in the
browser's address bar up-to-date
Routes
• This means that, at any point, users are able to share the
URL of your app. When someone clicks the link, they
reliably see the same content as the original user.
• Can also…
…set properties in Controllers
…execute events and actions
…connect a particular template to a particular controller
Templates
• The HTML (user interface) of your application
• Each template is backed by a model, accessed via the
controller, and the template automatically updates itself if the
model changes
• Written in the Handlebars templating language
• So they can include things such as…
…other templates
…usual logic such as if and else
Templates
…loops
…formatting helpers
…expressions, like {{firstName}}, which take information from
the template's model and put it into HTML
…outlets, which are placeholders in a template that routers can
plug other templates into. You can put outlets into your template
using the {{outlet}} helper.
…components, custom HTML elements that you can use to
clean up repetitive templates or create reusable controls.
Views
• Represent the visual parts of your application that the user can see
in the browser
• Associated with a controller, a handlebars template and a route
• Handle events or custom interactions that are impossible to manage
from templates
• didInsertElement hook where can interact with jQuery very easily
• Become extremely useful when you need to build reusable views,
such as modals, popovers, date-pickers and autocomplete fields
Controllers
• Objects that store application state
• Have a model set on them by a route
• Act as bridge between the model and the view or
template
• A template can retrieve properties from both the model
and a controller
• Are auto-generated if not explicitly defined
Components
• A completely isolated View that has no access to the
surrounding context
• A great way to build reusable components for your
applications
http://www.smashingmagazine.com/wp-content/uploads/2013/09/ember-sketch.png
About Controllers
Controllers
• Allow you to decorate your models with display logic
• In general, your models will have properties that are
saved to the server, while controllers will have properties
that your app does not need to save to the server
• When a template references a property, the property
value on the controller is returned if it exists, otherwise
the model assigned to the controller is looked at next
Controllers
• There are three different types of controllers:
• Controller
• Value store
• ObjectController
• Represents a single model
• ArrayController
• Represents an array of models
Controllers
• If you don't specifically define a controller for a route,
Ember will automatically make one for you based on the
return value of the route's model hook
• If it returns an object (such as a single record), an
ObjectController will be generated
• If it returns an array, an ArrayController will be generated
• If it does not return anything, an instance of
Ember.Controller will be generated
Naming Conventions
Naming Conventions
• When your application boots, Ember will look for these
objects:
• App.ApplicationRoute
• App.ApplicationController
• the application template
Naming Conventions
• If your user navigates to /favorites, Ember will look for
these objects:
• App.FavoritesRoute
• App.FavoritesController
• the favorites template
Organizing an
Ember application
Single file
Multiple files and directories
Multiple files and directories
• Requires being built into single application file
• Can be done with variety of tools, such as Brunch,
Mimosa, Grunt or Broccoli
• Strongly recommend Ember CLI
Live Code Examples
http://samhuri.net/f/ember-structure.png
Take Aways
• Architecture in Ember applications is dictated by routes
and templates
• Controllers are like decorators for your models; routes are
more like traditional controllers for your application
• Think long and hard before putting actions on controllers.
Should instead put them on the lowest shareable route.
Resources
• emberjs.com/guides
• emberjs.com/guides/cookbook
• discuss.emberjs.com
• github.com/emberjs/ember-inspector
Sources
• emberjs.com
• smashingmagazine.com/2013/11/07/an-in-depth-
introduction-to-ember-js/
• http://samhuri.net/f/ember-structure.png

More Related Content

What's hot

Catalyst 1 Introduction
Catalyst 1   IntroductionCatalyst 1   Introduction
Catalyst 1 IntroductionAran Deltac
 
Codeigniter simple explanation
Codeigniter simple explanation Codeigniter simple explanation
Codeigniter simple explanation Arumugam P
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantNitin Sawant
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVCEmad Alashi
 
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazingMortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazingTom Walker
 
Resistance is futile: Start writing accessible websites now!
Resistance is futile: Start writing accessible websites now!Resistance is futile: Start writing accessible websites now!
Resistance is futile: Start writing accessible websites now!Vegard Haugstvedt
 
VIPER Architecture
VIPER ArchitectureVIPER Architecture
VIPER ArchitectureAhmed Lotfy
 
WebMate: A Tool for Testing Web 2.0 Applications
WebMate: A Tool for Testing Web 2.0 ApplicationsWebMate: A Tool for Testing Web 2.0 Applications
WebMate: A Tool for Testing Web 2.0 ApplicationsAnwarrChaudary
 
Information Architecture & UI Design
Information Architecture & UI DesignInformation Architecture & UI Design
Information Architecture & UI DesignIvano Malavolta
 
Introducing asp.net core mvc web application
Introducing asp.net core mvc web applicationIntroducing asp.net core mvc web application
Introducing asp.net core mvc web applicationJoy Sarker
 

What's hot (17)

Catalyst 1 Introduction
Catalyst 1   IntroductionCatalyst 1   Introduction
Catalyst 1 Introduction
 
Angular js
Angular jsAngular js
Angular js
 
Codeigniter simple explanation
Codeigniter simple explanation Codeigniter simple explanation
Codeigniter simple explanation
 
MVC Training Part 1
MVC Training Part 1MVC Training Part 1
MVC Training Part 1
 
ASP .net MVC
ASP .net MVCASP .net MVC
ASP .net MVC
 
Angular js
Angular jsAngular js
Angular js
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin Sawant
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazingMortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
 
Resistance is futile: Start writing accessible websites now!
Resistance is futile: Start writing accessible websites now!Resistance is futile: Start writing accessible websites now!
Resistance is futile: Start writing accessible websites now!
 
VIPER Architecture
VIPER ArchitectureVIPER Architecture
VIPER Architecture
 
Mashcat 2017
Mashcat 2017Mashcat 2017
Mashcat 2017
 
WebMate: A Tool for Testing Web 2.0 Applications
WebMate: A Tool for Testing Web 2.0 ApplicationsWebMate: A Tool for Testing Web 2.0 Applications
WebMate: A Tool for Testing Web 2.0 Applications
 
Information Architecture & UI Design
Information Architecture & UI DesignInformation Architecture & UI Design
Information Architecture & UI Design
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 
Mvc
MvcMvc
Mvc
 
Introducing asp.net core mvc web application
Introducing asp.net core mvc web applicationIntroducing asp.net core mvc web application
Introducing asp.net core mvc web application
 

Viewers also liked

An introduction to Ember.js
An introduction to Ember.jsAn introduction to Ember.js
An introduction to Ember.jscodeofficer
 
Intro to Ember.js
Intro to Ember.jsIntro to Ember.js
Intro to Ember.jsJay Phelps
 
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.0Codemotion
 
a model for a muslim youth in the story of Yusuf AS
a model for a muslim youth in the story of Yusuf ASa model for a muslim youth in the story of Yusuf AS
a model for a muslim youth in the story of Yusuf ASAfif Suaidi
 
SXSW Interactive 2013 : ce que vous avez manqué
SXSW Interactive 2013 : ce que vous avez manquéSXSW Interactive 2013 : ce que vous avez manqué
SXSW Interactive 2013 : ce que vous avez manquéEmmanuel Fraysse
 
Hanki ja työllistä! -itseopiskelumateriaali
Hanki ja työllistä! -itseopiskelumateriaaliHanki ja työllistä! -itseopiskelumateriaali
Hanki ja työllistä! -itseopiskelumateriaaliTHL
 
The netflix way of life
The netflix way of lifeThe netflix way of life
The netflix way of lifeDaniel Halpern
 
Azure storage queues czy azure service bus, oto jest pytanie
Azure storage queues czy azure service bus, oto jest pytanieAzure storage queues czy azure service bus, oto jest pytanie
Azure storage queues czy azure service bus, oto jest pytanieMarcin Hoppe
 
Master mx 73a edicion
Master mx 73a edicionMaster mx 73a edicion
Master mx 73a edicionMaster Mx
 
Comederos para la Ganadería. Asi Ganadero
Comederos para la Ganadería. Asi Ganadero Comederos para la Ganadería. Asi Ganadero
Comederos para la Ganadería. Asi Ganadero Asi Ganadero
 
Meetup Processos de Desenvolvimento São Paulo - Gamestorming
Meetup Processos de Desenvolvimento São Paulo - GamestormingMeetup Processos de Desenvolvimento São Paulo - Gamestorming
Meetup Processos de Desenvolvimento São Paulo - GamestormingDan Vitoriano
 

Viewers also liked (15)

Intro to Ember.JS 2016
Intro to Ember.JS 2016Intro to Ember.JS 2016
Intro to Ember.JS 2016
 
An introduction to Ember.js
An introduction to Ember.jsAn introduction to Ember.js
An introduction to Ember.js
 
Intro to Ember.js
Intro to Ember.jsIntro to Ember.js
Intro to Ember.js
 
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
 
a model for a muslim youth in the story of Yusuf AS
a model for a muslim youth in the story of Yusuf ASa model for a muslim youth in the story of Yusuf AS
a model for a muslim youth in the story of Yusuf AS
 
SXSW Interactive 2013 : ce que vous avez manqué
SXSW Interactive 2013 : ce que vous avez manquéSXSW Interactive 2013 : ce que vous avez manqué
SXSW Interactive 2013 : ce que vous avez manqué
 
Hanki ja työllistä! -itseopiskelumateriaali
Hanki ja työllistä! -itseopiskelumateriaaliHanki ja työllistä! -itseopiskelumateriaali
Hanki ja työllistä! -itseopiskelumateriaali
 
My black pencil
My black pencilMy black pencil
My black pencil
 
Kablosuz ağlar
Kablosuz ağlarKablosuz ağlar
Kablosuz ağlar
 
The netflix way of life
The netflix way of lifeThe netflix way of life
The netflix way of life
 
Azure storage queues czy azure service bus, oto jest pytanie
Azure storage queues czy azure service bus, oto jest pytanieAzure storage queues czy azure service bus, oto jest pytanie
Azure storage queues czy azure service bus, oto jest pytanie
 
Mit Guerilla Marketing zu einem verbesserten Marketing ROI
Mit Guerilla Marketing zu einem verbesserten Marketing ROIMit Guerilla Marketing zu einem verbesserten Marketing ROI
Mit Guerilla Marketing zu einem verbesserten Marketing ROI
 
Master mx 73a edicion
Master mx 73a edicionMaster mx 73a edicion
Master mx 73a edicion
 
Comederos para la Ganadería. Asi Ganadero
Comederos para la Ganadería. Asi Ganadero Comederos para la Ganadería. Asi Ganadero
Comederos para la Ganadería. Asi Ganadero
 
Meetup Processos de Desenvolvimento São Paulo - Gamestorming
Meetup Processos de Desenvolvimento São Paulo - GamestormingMeetup Processos de Desenvolvimento São Paulo - Gamestorming
Meetup Processos de Desenvolvimento São Paulo - Gamestorming
 

Similar to Getting Started with Ember.js

Similar to Getting Started with Ember.js (20)

Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
 
Ember.js: Jump Start
Ember.js: Jump Start Ember.js: Jump Start
Ember.js: Jump Start
 
Ember vs Backbone
Ember vs BackboneEmber vs Backbone
Ember vs Backbone
 
[2015/2016] Backbone JS
[2015/2016] Backbone JS[2015/2016] Backbone JS
[2015/2016] Backbone JS
 
Backbone JS for mobile apps
Backbone JS for mobile appsBackbone JS for mobile apps
Backbone JS for mobile apps
 
A Beginner's Guide to Ember
A Beginner's Guide to EmberA Beginner's Guide to Ember
A Beginner's Guide to Ember
 
Ember - introduction
Ember - introductionEmber - introduction
Ember - introduction
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
Introduction to Ember.js
Introduction to Ember.jsIntroduction to Ember.js
Introduction to Ember.js
 
Angular js 1.3 basic tutorial
Angular js 1.3 basic tutorialAngular js 1.3 basic tutorial
Angular js 1.3 basic tutorial
 
Angular
AngularAngular
Angular
 
Brief Introduction to Ember
Brief Introduction to EmberBrief Introduction to Ember
Brief Introduction to Ember
 
JavaScript MVC Frameworks: Backbone, Ember and Angular JS
JavaScript MVC Frameworks: Backbone, Ember and Angular JSJavaScript MVC Frameworks: Backbone, Ember and Angular JS
JavaScript MVC Frameworks: Backbone, Ember and Angular JS
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
 
Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Show Some Spine!
Show Some Spine!Show Some Spine!
Show Some Spine!
 
Using MVC with Kentico 8
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
 
Ember App Kit & The Ember Resolver
Ember App Kit & The Ember ResolverEmber App Kit & The Ember Resolver
Ember App Kit & The Ember Resolver
 

Recently uploaded

定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Lucknow
 

Recently uploaded (20)

定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
 

Getting Started with Ember.js

  • 1. Introduction to Ember.js Ember Dallas - 18 Aug 2014 Jeremy Brown - notmessenger.com
  • 2. What is Ember.js? ( besides awesome! )
  • 3. Ember is… • A framework for creating ambitious web applications • Built for productivity • Opinionated • Sometimes perceived as difficult to learn (Not to scale)
  • 5. • Models • Routes • Templates • Views • Controllers • Components
  • 6. Models • An object that stores persistent state • Templates are responsible for displaying the model to the user by turning it into HTML • In many applications, models are loaded via an HTTP JSON API, although Ember is agnostic to the backend that you choose
  • 7. Routes • URL representations of your application’s objects, telling the template which model it should display (such as a url of /cars renders a collection of cars) • Queries the model and makes it available in the controller and templates • As the templates or models being shown to the user change, Ember automatically keeps the URL in the browser's address bar up-to-date
  • 8. Routes • This means that, at any point, users are able to share the URL of your app. When someone clicks the link, they reliably see the same content as the original user. • Can also… …set properties in Controllers …execute events and actions …connect a particular template to a particular controller
  • 9. Templates • The HTML (user interface) of your application • Each template is backed by a model, accessed via the controller, and the template automatically updates itself if the model changes • Written in the Handlebars templating language • So they can include things such as… …other templates …usual logic such as if and else
  • 10. Templates …loops …formatting helpers …expressions, like {{firstName}}, which take information from the template's model and put it into HTML …outlets, which are placeholders in a template that routers can plug other templates into. You can put outlets into your template using the {{outlet}} helper. …components, custom HTML elements that you can use to clean up repetitive templates or create reusable controls.
  • 11. Views • Represent the visual parts of your application that the user can see in the browser • Associated with a controller, a handlebars template and a route • Handle events or custom interactions that are impossible to manage from templates • didInsertElement hook where can interact with jQuery very easily • Become extremely useful when you need to build reusable views, such as modals, popovers, date-pickers and autocomplete fields
  • 12. Controllers • Objects that store application state • Have a model set on them by a route • Act as bridge between the model and the view or template • A template can retrieve properties from both the model and a controller • Are auto-generated if not explicitly defined
  • 13. Components • A completely isolated View that has no access to the surrounding context • A great way to build reusable components for your applications
  • 16. Controllers • Allow you to decorate your models with display logic • In general, your models will have properties that are saved to the server, while controllers will have properties that your app does not need to save to the server • When a template references a property, the property value on the controller is returned if it exists, otherwise the model assigned to the controller is looked at next
  • 17. Controllers • There are three different types of controllers: • Controller • Value store • ObjectController • Represents a single model • ArrayController • Represents an array of models
  • 18. Controllers • If you don't specifically define a controller for a route, Ember will automatically make one for you based on the return value of the route's model hook • If it returns an object (such as a single record), an ObjectController will be generated • If it returns an array, an ArrayController will be generated • If it does not return anything, an instance of Ember.Controller will be generated
  • 20. Naming Conventions • When your application boots, Ember will look for these objects: • App.ApplicationRoute • App.ApplicationController • the application template
  • 21. Naming Conventions • If your user navigates to /favorites, Ember will look for these objects: • App.FavoritesRoute • App.FavoritesController • the favorites template
  • 24. Multiple files and directories
  • 25. Multiple files and directories • Requires being built into single application file • Can be done with variety of tools, such as Brunch, Mimosa, Grunt or Broccoli • Strongly recommend Ember CLI
  • 28. Take Aways • Architecture in Ember applications is dictated by routes and templates • Controllers are like decorators for your models; routes are more like traditional controllers for your application • Think long and hard before putting actions on controllers. Should instead put them on the lowest shareable route.
  • 29. Resources • emberjs.com/guides • emberjs.com/guides/cookbook • discuss.emberjs.com • github.com/emberjs/ember-inspector