Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
15 Things You Shouldn't Do In Ember Anymore
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kerrick Long
August 03, 2015
Programming
1.2k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
15 Things You Shouldn't Do In Ember Anymore
Kerrick Long
August 03, 2015
More Decks by Kerrick Long
See All by Kerrick Long
The ECMAScript formerly known as 6
kerrick
0
1.4k
CSS Study Group 1
kerrick
0
1.3k
CSS Study Group 2
kerrick
1
1.1k
Services & Component Collaboration
kerrick
0
810
Donate STL #Build4STL Hackathon Keynote
kerrick
0
420
Donate STL
kerrick
0
840
TDD With Ember.js
kerrick
0
1.3k
JavaScript Promises - Thinking Sync in an Async World
kerrick
20
8.4k
Other Decks in Programming
See All in Programming
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
280
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
13k
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
920
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
2
720
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
300
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.5k
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6.5k
スマートグラスで並列バイブコーディング
hyshu
0
260
New "Type" system on PicoRuby
pocke
1
1k
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
270
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
120
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
7k
Featured
See All Featured
We Are The Robots
honzajavorek
0
250
GraphQLとの向き合い方2022年版
quramy
50
15k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.6k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Believing is Seeing
oripsolob
1
150
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
210
Six Lessons from altMBA
skipperchong
29
4.3k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
250
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.5k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Transcript
15 Things You shouldn’t be doing in Ember.js anymore
Kerrick Long Things I make and do Where to find
me online twitter.com/KerrickLong github.com/Kerrick Lead Front-end Developer at Second Street KerrickLong.com www. meetup.com/ STLEmber
Not using Ember CLI
npm install -g ember-cli ember new my-project
Using needs in Controllers
import Ember from 'ember'; export default Ember.Controller.extend({ needs: ['pages'],
title: 'controllers.pages.model.title' }); Using needs in Controllers
import Ember from 'ember'; export default Ember.Controller.extend({ pages: Ember.inject.controller(),
title: 'pages.model.title' }); Using inject in Controllers
import Ember from 'ember'; export default Ember.Controller.extend({ foo: Ember.inject.controller('pages'),
title: 'foo.model.title' }); Using inject in Controllers
Computed properties with getter / setter in one function
import Ember from 'ember'; export default Em.Service.extend({ minutes: 480,
hours: Em.computed('minutes', function(k, v) { if (arguments.length > 1) { this.set('minutes', v * 60); } return this.get('minutes') / 60; }) }); Computed getter / setter
Computed getter / setter import Ember from 'ember'; export
default Em.Service.extend({ minutes: 480, hours: Em.computed('minutes', { get() { return this.get('minutes') / 60; }, set(k, v) { return this.set('minutes', v * 60); } }) });
Using this.resource in the router
Using this.resource Router.map(function() { this.resource('pages', function() { this.resource('comments'); }); });
// app/routes/comments/index.js export default Ember.Route.extend({ model() { return this.store.find('comments'); } });
Using this.resource Router.map(function() { this.route('pages', function() { this.route('comments'); }); });
// app/routes/pages/comments/index.js export default Ember.Route.extend({ model() { return this.store.find('comments'); } });
Using {{bind- attr}}
Using {{bind-attr}} <button {{bind-attr title=buttonTitle}}> Submit! </button>
Using {{bind-attr}} <button title={{buttonTitle}}> Submit! </button>
{{#each}} without as
{{#each}} with in <ul> {{#each messages}} <li>{{text}}</li> {{/each}} </ul>
{{#each}} with in <ul> {{#each message in messages}} <li>{{message.text}}</li> {{/each}}
</ul>
{{#each}} with in <ul> {{#each messages as |message|}} <li>{{message.text}}</li> {{/each}}
</ul>
Using the {{render}} helper
The {{render}} helper <div> {{render "my-controller" model}} </div>
The {{render}} helper <div> {{my-component thing=model}} </div>
Using the {{view}} helper
ember g component new-way
Using Ember.Select
Using {{view "select"}} {{view "select" content=model.pages optionValuePath="content.id" optionLabelPath="content.title" prompt="-- Select
One --" }}
Using {{view "select"}} “Make your own.” http://emberjs.com/deprecations/v1.x/#toc_ember-select
Using {{view "select"}} “Make your own.” http://emberjs.com/deprecations/v1.x/#toc_ember-select Or use a
legacy addon.
Creating arrayComputed properties
Using arrayComputed import Ember from 'ember'; export default Ember.Controller.extend({
uniqueChildren: Ember.arrayComputed('
[email protected]
.[]', { addedItem: function(accumulatedValue, model) { accumulatedValue.addObjects(model.get('children')); return accumulatedValue.uniq(); }, removedItem: function(accumulatedValue, model) { accumulatedValue.removeObjects(model.get('children')); return accumulatedValue.uniq(); } }) });
Using arrayComputed import Ember from 'ember'; export default Ember.Controller.extend({
uniqueChildren: Ember.computed('
[email protected]
.[]', function() { return _.flatten(this.get('model').map(x => x.get('children'))).uniq(); }) });
Creating reduceComputed properties
Using reduceComputed import Ember from 'ember'; export default Ember.Controller.extend({
total: Ember.reduceComputed('
[email protected]
', { initialValue: 0, addedItem(accumulatedValue, item) { return accumulatedValue + item.get('value'); }, removedItem(accumulatedValue, item) { return accumulatedValue - item.get('value'); } }) });
Using reduceComputed import Ember from 'ember'; export default Ember.Controller.extend({
total: Ember.computed('
[email protected]
', function() { const addValues = (p, x) => p + x.get('value'); return this.get('model').reduce(addValues, 0); }) });
Using ObjectController
Using ObjectController import Ember from 'ember'; export default Ember.ObjectController.extend({
foo: Ember.computed.not('bar') });
Using ObjectController import Ember from 'ember'; export default Ember.Controller.extend({
foo: Ember.computed.not('model.bar') });
Using ArrayController
Using ArrayController import Ember from 'ember'; export default Ember.ArrayController.extend({
sortProperties: ['date', 'name'] // You can use `arrangedContent` });
Using ArrayController import Ember from 'ember'; export default Ember.Controller.extend({
arrangedContent: Ember.computed.sort(/**/) });
Using {{#each}} with itemController
ember g component new-way
Mutating data in components
Parent Child data manipulation manipulation source of data
Parent Child data manipulation source of data
Parent Child data manipulation actions regarding user input or intent
source of data
Thank you.