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
モダンAngularJS @ GDG中国2014.12.6
Search
OKUNOKENTARO
December 06, 2014
Programming
1
430
モダンAngularJS @ GDG中国2014.12.6
2014年12月6日発表分の資料をSlideShareより再掲。
http://www.slideshare.net/armorik83/angularjs-141206
OKUNOKENTARO
December 06, 2014
Tweet
Share
More Decks by OKUNOKENTARO
See All by OKUNOKENTARO
トレタO/X アーキテクチャ移行記 Next.js App Router化への道のり / TORETA TECH UPDATE 1
okunokentaro
5
9.6k
Podcastを継続する技術 / refactoradio-240119
okunokentaro
1
160
Webアプリケーション設計の第一歩は ディレクトリの整理から / Encraft 1
okunokentaro
34
9.9k
JSONとJSON Schemaを改めて理解する / tokyo_study
okunokentaro
9
2.2k
それでもどうしてRecoilを使うのか / Harajuku.ts Meetup Recoil
okunokentaro
19
5.4k
TypeScriptは10年でこんなに進化しました / TechFeed Experts Night 11
okunokentaro
6
1.7k
Hasura.io RDBをサクサク作る方法はARやO/RMだけじゃなくなりました/hasura-io
okunokentaro
5
620
コードには型アノテーションよりも要件アノテーションを増やせ!/harajukuts2
okunokentaro
14
6.2k
10年と3ヶ月でWebサービスを作った話 / Piyogrammer Conference 2021
okunokentaro
2
1k
Other Decks in Programming
See All in Programming
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
Better Code Design in PHP
afilina
PRO
0
130
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
Click-free releases & the making of a CLI app
oheyadam
2
120
TypeScript Graph でコードレビューの心理的障壁を乗り越える
ysk8hori
2
1.1k
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
イベント駆動で成長して委員会
happymana
1
330
役立つログに取り組もう
irof
28
9.6k
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
890
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Typedesign – Prime Four
hannesfritz
40
2.4k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Being A Developer After 40
akosma
87
590k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
Fireside Chat
paigeccino
34
3k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
130
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Transcript
ٌتٝAngularJS %FD 痥㔐(%(⚥㕂⹈䓼⠓
荈䊹稱➜ ˖ 㤴ꅿ颩㣕龤0LVOP,FOUBSP ˖ ❨鿪䋐ַ勻ת׃
鹈أزحؙ侧501חג "OHVMBS+4،ٝثػة٦ٝ꧊ָ ⡘ְֹת׃ http://qiita.com/armorik83/items/b00818ecaf2e93734b36
?AngularJS ׀㶷濼דׅ״י
? 兛媮噟ծ⟃㢩ろ "OHVMBS+4剅ְגְהְֲ倯
ֲד׃׳ֲ
ְֶׁ"OHVMBS+4הכ ˖ +BWB4DSJQUؿٖ٦يٙ٦ؙ (PPHMFָ涪Ⱅ䒭חכ.788IBUFWFSה׃גְ ˖ )5.-ك٦أךذٝفٖ٦ز ˖ 剅ֹװְׅر٦ة٥غ؎ٝر؍ؚٝ ˖ ٕ٦ذ؍ؚٝ堣圓
41"ח剑黝 ˖ "KBY؟ه٦ز 3&45"1*ך؟٦غ،فٔ؛٦ءّٝה湱䚍ָ葺ְ
㖇⦜涸 ˟BOHVMBSKT CBDLCPOF LOPDLPVU FNCFS WVFחKBWBTDSJQU➰♷׃ג嗚稊
չד"OHVMBS+4ג㱾ְպ ִ㱾גך ׄׯ֮姺גֲֶַֿ˘
չד"OHVMBS+4ג㱾ְպ ִ ׄׯ֮ ׳ה䖉ג
"1*ָמוְ 鋙ִֿה㢳ֺׅ 㼪Ⰵ؝أز넝ְ זֿהכזְ
植屣濼ֲ ˖ הכְִծ䩛佝׃דكة釈דֹֽדכזְ ˖ דכוזؿٖ٦يٙ٦ؙ♧筰 ˖ "OHVMBS+4ך植屣椚鍑׃ծ涸然חⵃ欽ׅ ˖ "OHVMBSث٦يך湡䭷ׅ倯ぢ䚍濼 䖓ղ⦜חזזְחכ
،ؐزٓ؎ٝ "OHVMBS+4Y禸ַ禸פ ⡦חぢְגְךַ 鋙ִקֲָ״ְךծ鋙ִזֻג״ְך 縐
涪橆㞮ך⢽
،ؐزٓ؎ٝ "OHVMBS+4Y禸ַ禸פ ⡦חぢְגְךַ 鋙ִקֲָ״ְךծ鋙ִזֻג״ְך 縐
涪橆㞮ך⢽
׀㶷濼דַׅ "OHVMBSָ涪⚥דׅ
K2VFSZٔ ٔ ٦ أ "OHVMBS+4 "OHVMBS+4 YY"OHVMBS הכְִծٔٔ٦أ儗劍כ劢㹀 ֶֶ״ך儗劍ׅ僇鎉ׁגְתׇ
禸ך暴ꞿ ˖ 䎃剢傈ח⪵ׁOHFVSPQFחג ؽآָّٝ爙ׁ ˖ ٌتٝـٓؐؠ䠐陎 &4 &$."4DSJQU ד圓眠ծ&4דⵃ欽〳腉 ˖
"U4DSJQUהְֲ䭁䓸鎉铂 㘗➰ֽծ،ظذ٦ءّٝծ㣐鋉垷⻉פך佄䴂 ˖ KR-JUFך䐖姺ծػؿؓ٦وٝأぢ♳ K2VFSZ⢪欽♶〳הזֽדכזְ ˟䎃剢植㖈ך䞔㜠
遼䷼涸ז䞔㜠 ˖ $POUSPMMFSָ搀ֻז %JSFDUJWFה)5.-ذٝفٖ٦زָ㼎הז ˖ $TDPQFָ搀ֻז 顑⟣ⴓ䬐ծ䞔㜠ך撑ծⰟ剣ך➬穈״僇然חׅ ˟䎃剢植㖈ך䞔㜠
ؖٓحה㢌הַ䙳ְ ׄׯ֮姺גֲֶַֿ˘
ؖٓحה㢌הַ䙳ְ ׄׯ֮ ׳ה䖉ג
ךٔٔ٦أ傈כ劢㹀דׅ ˖ ַׇֻ"OHMVBS+4TUBCMFָ֮ךחծٔٔ٦أ傈 劢㹀ך"OHVMBSך㢌⻉䛊ג姺תַׅ ˖ ⡦⢪ֲדַׅ ˖ "OHVMBSךؽآّٝכծ涪ث٦يָ չ״"OHVMBS׃ֻպ湡䭷׃穠卓 ˖
ך䠐㔳穈ד植㖈ך"OHVMBS+4剅ֽל 㼛勻㣐ֹז幉✉חכ荚זְךדכ
"OHVMBSث٦يָ דؖٓٔה㢌ִ״ֲה׃גְ椚歋כ ?
"OHVMBSָ湡䭷ׅך ˖ ٌتٝ٥ؿٖ٦يٙ٦ؙפ ˖ &4 &$."4DSJQU דך㹋鄲 ˖ "U4DSJQUח״㣐鋉垷فٗتؙزך鎸鶢佄䴂 ˖
״侭椚ׁ"1* ˖ 鋙ִֿה㢳ֺׅגEJTךծ荈鋙׃ג׃ְ
&4ג⡦ ˖ &$."4DSJQUؙؒو٥أؙٔفزהכ+BWB4DSJQUך垥彊鋉呓 䧮ղָ+BWB4DSJQUהㄎע鎉铂כـٓؐؠ嫣ח倯鎉ֽ ˖ 植㖈ךٌتٝـٓؐؠ *& כ&4ח㼎䘔 &4Ⰻג㹋鄲ׅـٓؐؠכ植㖈搀׃ ˖
DMBTT祩邅圓俑ծNPEVMF堣圓ծ1SPNJTFך垥彊⻉זוזו ˖ 鑫稢כؚؚגי http://kangax.github.io/compat-table/es6/ؔأأً
"U4DSJQUג⡦ ˖ ךח5ZQF4DSJQU.JDSPTPGU爡 ֿכ涸㘗➰ֽ圓俑⪒ִծ؝ٝػ؎ٓח״ג 㢌䳔儗חؒٓ٦ثؑحؙ׃+BWB4DSJQU欰䧭ׅ鎉铂 ˖ ֿך5ZQF4DSJQUׁח䭁䓸׃ "OHVMBSث٦يָ䲿周ׅ圓俑刹ֻ倜鎉铂דכזְ ˖ "U4DSJQUדכ㘗➰ֽח⸇ִגծ
ًةر٦ة鎸鶢ծ،ظذ٦ءّٝך圓俑酡䓼 @Directive({ selector: '[blink]' }) class Blink { constructor(elment: Element, options: Options, timeout: Timeout) { // ... } }
"OHVMBS+4 5ZQF4DSJQU ˖ 5ZQF4DSJQUכ&4ך圓俑⯓遤㼪Ⰵ׃גְ ˖ DMBTT NPEVMFזו ˖ 㢌䳔ׅךדծ&4ךـٓؐؠד⹛ֻ ˖
涸㘗➰ֽה؝ٝػ؎ٓח״ؒٓ٦ثؑحؙ ˖ 㣐鋉垷涪קו؝ٝػ؎ٓך佄䴂ָꅾ銲ח ˖ "OHVMBSד䲿周ׁ"U4DSJQUח➙ַ䢪זֿ ˖ 5ZQF4DSJQU荈⡤ծⰋגך+BWB4DSJQUח崞ַׇךד 鋙ִגְֶג䴦כזְ
ٌتٝAngularJS 1 ➙ַ&4俑岀ָ⢪ִ "OHVMBSث٦ي㛇燉ה׃ג䱰欽׃ 5ZQF4DSJQUד剅ֻ
$POUSPMMFS搀ֻזׯֲ ˖ 搀ֻז״ֲדׅ ˖ "OHVMBSךٔٔ٦أכ劢㹀זךח 䎃חֶ❕ֻזהׁ ˖ אתך儗挿ד䐖姺 鋅馉׃קֲָ״ְ
OHDPOUSPMMFSג ˖ ➙זֶ㢳ֻךثُ٦زٔ،ٕװـؚٗד稱➜ׁגְ OHDPOUSPMMFS ˖ ֮כ)5.-ך"UUSJCVUFTדכזֻ ⽃ז%JSFDUJWFך♧珏ד֮ ˖ ֿג䗳갭זךַ <div
ng-controller="MainCtrl">...</div>
鋅馉׃$POUSPMMFS ˖ %JSFDUJWFחDPOUSPMMFS"1*ָ֮תׅ ˖ %JSFDUJWF⡲גծ%JSFDUJWF$POUSPMMFSהׅ ˖ OHDPOUSPMMFSה<div>ח♧⦐䭷㹀׃ג 䖓כؤٓؤٓⳢ椚剅ָֹ ˖ ֿךٕ٦ٕחֿׅהד⦐ղך%JSFDUJWF넝Ⳕ꧊פ
.77.ך罋ִ倯 ˖ OH3PVUFٕ٦ذ؍ؚٝדDPOUSPMMFS䭷㹀כ׃זְ ̔7JFXֽ䭷㹀׃ծך7JFXח%JSFDUJWFֽ縧ֻ
ٌتٝAngularJS 2 OHDPOUSPMMFS⢪׆ %JSFDUJWFDPOUSPMMFS欽ְ
$TDPQF搀ֻזׯֲ ˖ 搀ֻז״ֲדׅ ˖ 植㖈חְֶגDPOUSPMMFS"T圓俑ָ 钠濼ׁגַ⳿殢ָ慧幾 ˖ $TDPQFך"1*XBUDIװCSPBEDBTU POכ➙ד⢪ֲ
鋅馉׃$TDPQF ˖ 植㖈㹋鄲⚥תכ珩⫴⚥ךءأذيחOHDPOUSPMMFSָ ֮ג$scope⢪גתׅהְֲ倯 ˖ 獳遤ָ㣐㢌ֲזծת׆כDPOUSPMMFS"T圓俑ך䱰欽פ ˖ 鋵㶨ד幉✉ׅקו$scopeך䞔㜠װה ׃גծׯ鏣鎘ך㉏겗 <div
ng-controller="MainCtrl as main">...</div>
$CSPBEDBTU PO⢪ֲ ˖ ⦐ղך%JSFDUJWFכהחַֻ⡚穠さד⡲ ˖ ⡦ַך؎كٝزךزٔؖ٦ח$broadcast⢪ְ 꽀⹛⩎כ$onד「ֽ ˖ 涪⥋⩎כծ➭ך؝ٝه٦طٝزָוֲ⹛ַֻ 「⥋⩎כծוךة؎ىؚٝד؎كٝزָ涪ַׇ
ֶ✼ְ濼זֻגְְ⡚穠さ
׃剑㊣דכזְ ˖ $broadcast, $onכ剑㊣ך،فٗ٦ثדכזְ ˖ 俑㶵ٔذٕٓדװהַׅד֮ ! ˖ *%&ך佄䴂「ֽחְֻ ˖
鍑寸岀ה׃גכծ$broadcast荈⡤ ׅץגTFSWJDFדٓحؾؚٝ׃ծًاحسה׃ג䪔ֲ $onח剅ֻ؎كٝزせծךTFSWJDFַ《䖤ׅ ًاحسせז*%&ָ钠陎׃ג酡㸣׃גֻ $scope.$broadcast('EventNameString', args);
׃剑㊣דכזְ ˖ $broadcastךTFSWJDFٓحؾؚٝכ➙ךהֿ♳䩛ֻ ְגְ ˖ ׃ַ׃؎كٝز꽀⹛ךⰋג♧אךTFSWJDFדٓحف ׅהծכד㉏겗 荈ⴓכⴓꅿⴽח黝㹅㼭ⴓֽח׃גְתׅ ˖ $scopeךفٗػذ؍搀꠹ח鋵㶨דⰟ剣׃
铣剅ֹׅ״כ然㹋 劤갈鎉ֲהדהְְ堣圓実
ٌتٝAngularJS 3 鋵㶨ד$TDPQFךⰟ剣כ⽬ꤹ ⡚穠さח⡲ ؎كٝز꽀⹛䠐陎
何葺ׁתׅ ˖ "OHVMBS+4Y禸ծָٔٔ٦أׁג穄דכזְ ˖ ׅדחךو؎ش٦،حفر٦زָٔٔ٦أ ˖ ך湫禸ד֮鹌遤⚥ ˖ ٕ٦ذ؍ؚٝծؿؓ٦يծ"KBYך何葺זוָ 嗚鎢ׁגְ垷圫
http://www.linkplugapp.com/a/1042855 ˟䎃剢植㖈ך䞔㜠
،ؐزٓ؎ٝ "OHVMBS+4Y禸ַ禸פ ⡦חぢְגְךַ 鋙ִקֲָ״ְךծ鋙ִזֻג״ְך 縐
涪橆㞮ך⢽
猘荈魦ך؛٦أ ˖ 荈ⴓָוך״ֲח"OHVMBS+4⢪גְַ ˖ 噟ءأذي 噟خ٦ٕծ،ؙإ؟ٔך㹋鄲 ˖ 㼛勻涸חֿך䪮遭ך♧鿇♧菙Ⱅֿׅה 湡锷㛇湍⡲ ֿז䠬ׄד⡲גתׅ
⦐➂涸ז䠬䟝דכ֮תָׅ ˖ 涪כ鸞ְדׅ ˖ ر٦ة٥غ؎ٝر؍ؚٝワָ侭גְךד ؛٦أךفٗزة؎فָּׅ⳿勻 ּׅ⹛ֻךדٌثك٦ءّٝכ笝䭯׃װְׅ ˖ 3&45"1*ה鋵ㄤ䚍ָ넝ְךד傀㶷ךءأذيַ 獳遤׃װְׅכ׆
猘כ$BLF1)1ַOPEFKTח獳遤׃
41"דծ♧皘䨽ֽד ˖ %JSFDUJWFזג⢪זְծ IUNMⰻח湫䱸縧ְג ؿؓ٦يךغٔر٦ءّٝה׃גֽ⢪ְְ ְְ̔ה䙼ְתׅ ˖ ٕ٦ذ؍ؚٝⰋג"OHVMBS+4 ؿٕח堣腉⢪ג4JOHMF1BHF"QQMJDBUJPO涪ׅ ׅ̔ל׃ְ
˖ "OHVMBS+4ך䖤䠐הׅر٦ة٥غ؎ٝر؍ؚٝծ 3&45GVMծٕ٦ذ؍ؚٝהְⴓꅿַ⡦ָ⢪ִַ 鋅噰
ذأز׃װְׅ ˖ 41"涪דכ%JSFDUJWF4FSWJDFוו㟓ִתׅ ˖ "OHVMBSث٦يכذأزך׃װׁׅח ꅾ挿縧ְגְ ˖ %*ك٦أךٌآُ٦ٕ鸬䵿הծٌحؙ岣Ⰵ ˖ ذأزٓٝش٦,BSNB
˖ &&ذأز1SPUSBDUPS ذأز剅ְגזְהֶַ˘
ٌتٝAngularJS 4 ,BSNB 1SPUSBDUPSד ذأز䫙ַזֻ
،ؐزٓ؎ٝ "OHVMBS+4Y禸ַ禸פ ⡦חぢְגְךַ 鋙ִקֲָ״ְךծ鋙ִזֻג״ְך 縐
涪橆㞮ך⢽
鋙ִֿהָ㢳ֺׅ ֲדזְ
ת׆%JSFDUJWF鋙ִגְֻׁ
%JSFDUJWFח״ֻ֮铎鍑
˖ ꨇ׃ְ׃ְ %JSFDUJWFח״ֻ֮铎鍑
˖ ꨇ׃ְ׃ְ ˖ ⦜ְֻׁ׃ְ %JSFDUJWFח״ֻ֮铎鍑
˖ ꨇ׃ְ׃ְ ˖ ⦜ְֻׁ׃ְ ˖ "1*ָ醱꧟ֺׅ׃ְ %JSFDUJWFח״ֻ֮铎鍑
˖ ꨇ׃ְ׃ְ ˖ ⦜ְֻׁ׃ְ ˖ "1*ָ醱꧟ֺׅ׃ְ "1*Ⰻ鿇זג⢪זְ %JSFDUJWFח״ֻ֮铎鍑
穗꿀锑ַך%%0 ˖ %%0%JSFDUJWF%FGJOJUJPO0CKFDU ֮ךꞿְꞿְؔفءّٝծ%JSFDUJWFכ⦜ה䙼♧殢ך⾱㔓 ˖ SFTUSJDU%JSFDUJWFך邌鎸倯岀ծ㾩䚍せַծ銲稆せַ˘ ˖ ֿכ"㾩䚍せה׃גה&銲稆せה׃ג ֽ鋙ִגֶֻ֮הכ⢪זְ ˖
TDPQF4DPQF欰䧭ַׅⰟ剣ַׅ ˖ 䌢חؔـآؙؑز٥ٔذٕٓד䭷㹀 A new "isolate" scope. ˖ Ⱏ剣䲿ך鏣鎘כ鼘ֽקֲָ葺ְ scope: { attr: '@myAttr', foo: '=myFoo', bar: '@myBar' },
⢪זְ"1* ˖ SFQMBDFEFQSFDBUFE ˖ USBOTDMVEF䮙⹛ָ湫䠬涸דזֻծ嗚鏾ך䩛㟓װׅזל ⢪זֻגְְךדכ"1*铣ד䗳銲ה䠬ֿׄהָזְ ˖ NVMUJ&MFNFOU䗳銲חזֿהָזְ ➭ךٌآُ٦ٕ錁㻊׃ג鋅ַֽֿהָזְ ˖
QSJPSJUZ⮚⯓䏝孡חׅ䗳銲ך֮Ⰵ㶨כٔأؙ QSJPSJUZ⢪׆SFRVJSF⢪ֲ ˖ MJOLDPNQJMFך䨱⦼ַꟼ侧鵤ׇל״ְ ˟⦐➂ך䠬䟝דׅ
UFNQMBUF ˖ 䌢חUFNQMBUF6SM⢪גְ ˖ ֮ת+4ا٦أⰻח俑㶵ה׃גꞿְ)5.- 剅ֹֻזְ ˖ ׃ծ㼭ׁזػ٦خ遤ד幥״ֲזכDPNQJMFⰻח $templateCache.put()⢪ג剅ֻֿהָ㢳ְ
ٌتٝAngularJS 5 "OHVMBSח⪒ִז %JSFDUJWF琎噰涸ח荈⡲
ս剼㜠վ %%0 %JSFDUJWF%FOJUJPO0CKFDU כ "OHVMBSד䐖姺ׁתׅ
如ח4FSWJDF 'BDUPSZך麩ְ 鋙ִגֶֻךָؔأأً
4FSWJDFה'BDUPSZ ˖ 4FSWJDF؝ٝأزؙٓةꟼ侧♷ִג"OHVMBS+4ָ ؎ٝأةٝأ欰䧭 4JOHMFUPOה׃ג婍 ˖ 'BDUPSZ♷ִꟼ侧 㹋遤׃䨱⦼鵤ׅ function MyComponent()
{ // ... } ! angular.module('myModule') .service('MyComponent', MyComponent); ! angular.module('myModule') .factory('MyComponent', function() { return MyComponent; });
ٗحؙ؎ٝ眔㔲㼰זֻ ˖ "OHVMBS+4כ䊬㣐זؿٖ٦يٙ٦ؙ ♧䏝⢪ֲהٗحؙ؎ַׁٝ˘הְֲ䠐鋅耀ֻ ˖ ׃ַ׃"OHVMBS+4⢪גְג 㼛勻涸חYַחכ獳遤⡲噟ָ涪欰ׅכ׆ ˖ "OHVMBS+4הꟼ⤘זְٗآحؙכ זץֻ"OHVMBS+4ך㢩ח剅ֻץֹׄׯי
.PEFMה*OKFDU ˖ .7$ׅץג"OHVMBS+4דװֲהַׅ ٗحؙ؎ָٝ孡חַַגֻ ˖ "OHVMBS+4כ⽃ח3&45 7JFX.PEFM 5FNQMBUF ח暴⻉ ˖
.PEFMծؽآطأٗآحؙכ"OHVMBS+4"1*♧ⴖろתזְ 秪磏ז+4ה׃ג㹋鄲 ⟎ח"OHVMBS+4ָهءٍג➭'8ד⢪ְתׇ״ֲח
.PEFMה*OKFDU ˖ ֿך秪磏ז+4ךٓ؎ـٓٔ"OHVMBS+4ד欽ְ㜥さ 'BDUPSZ穗歋ד鵤ׅ ˖ ؚٗ٦غٕ㢌侧ח縧ְג"OHVMBS+4ד⢪ֲֿה⳿勻ָ ٌحؙ⻉דֹזְךדذأزך♳ד㉏겗ָ饯ֿ ˖ "OHVMBS+4ךِصحزذأزכ䮶莸ְך嗚鏾ח殅גծ &&ذأزח״㣐ֹז笨הծؽآطأٗآحؙך稢ַז
ِصحزذأزד⥂א angular.module('myModule') .factory('MyBusinessLogic', function() { return MyBusinessLogic; // ΠϯελϯεͰͳ͘ίϯετϥΫλࣗମΛฦ͢ });
ؔـآؙؑز䭷ぢ ˖ չ؎ٝأةٝأדכזֻ؝ٝأزؙٓة荈⡤鵤ׅպ הְֲ邌植ծ+BWB4DSJQUדכ׳ה꼧厩ָזְַ ˖ 5ZQF4DSJQUדכDMBTT DPOTUSVDUPSװ㘗➰ֽך嚊䙀ָ֮ ˖ 㢌䳔䖓ָ+BWB4DSJQUד֮זָծ+BWBװ$涸ז ؔـآؙؑز䭷ぢך罋ִ倯ד鹌ֿהָדֹ
+BWB4DSJQUֽד⳿勻ֽוQSPUPUZQFהְְַ剅ֻֿהָ⦜ ˖ 4FSWJDF'BDUPSZծ5ZQF4DSJQUהך湱䚍כהג״ְ "U4DSJQUָ涪邌ֿׁהծ鏾僇׃גְ
ٌتٝAngularJS 6 'BDUPSZח״JOKFDU崞欽׃ג "OHVMBS+4"1* ⢪זְⳢ椚כ㢩פ
4FSWJDFכ"OHVMBS+4ⰻח暴⻉ ˖ ♧倯ד4FSWJDFכ"OHVMBS+4"1*ך琎噰涸זⵃ欽ח暴⻉ ˖ $resource, $routeParams, $locationכ穗꿀♳ ؝٦سךꅾ醱ָ欰תװְׅ ˖ $PSF"1*ٓحف׃ծ荈ⴓ٥荈ث٦يָ⢪ְװְׅ
4FSWJDF欽䠐׃גⳢ椚♧⯋⻉ ˖ %JSFDUJWFDPOUSPMMFSכֻ֮תד醱侧ך4FSWJDFךⳢ椚ה 7JFX &WFOU穠ןאֽ؎ٝةؿؑ٦أח䗡ׅ
ٌتٝAngularJS 7 $PSF"1*⢪ְװֻׅٓحف 荈⡲4FSWJDFד Ⳣ椚ךꅾ醱鼘ֽ
Ⰻ鿇鋙ִ䗳銲כזְ
،ؐزٓ؎ٝ "OHVMBS+4Y禸ַ禸פ ⡦חぢְגְךַ 鋙ִקֲָ״ְךծ鋙ִזֻג״ְך 縐
涪橆㞮ך⢽
䢪ה䙳ֻזְדָׅ ׳ְ׳ְ縐ָ֮תׅ
˖ %*،ظذ٦ءّٝכ䗳׆剅ֹת׃׳ֲ ׁזֻלNJOJGZ儗ח岛ֹתׅ ˖ %*،ظذ٦ءّٝהכծ؎ٝأةٝأ欰䧭儗ח ؎ٝآؙؑزׅ4FSWJDF寸㹀ׅך䞔㜠 ˖ 䒷侧俑㶵דػ٦أ׃ג铣ד׃ְ˘ ה㢌䡾㹋鄲ָ鑧겗חזת׃ָծ㣐㢌״׃ֻזְדׅ 1.
minify対策 angular.module('myModule') .service('MyService', function(OtherService) { // ... ↑͜͜ʹແ͍!! }); ! angular.module('myModule') .service('MyService', ['OtherService', function(OtherService) { // ... }]);
˖ ⦐➂涸חכֿך剅ֹ倯ךקֲָ㥨ֹ ! ! ! ˖ .service()ⰻחꞿղה剅ֻ״طأز幾גأحؗٔ ˖ "OHVMBS+4ַng-strict-diָ鷄⸇ׁ ،ظذ٦ءّٝ鎸鶢怩ؒٓ٦ה׃ג䭷䶯ׅ
1. minify対策 function MyService(OtherService) { // ... } MyService.$inject = ['OtherService']; ! angular.module('myModule') .service('MyService', MyService); <body ng-app="myApp" ng-strict-di> ... </body>
˖ ٕ٦فⳢ椚כ縐הזװְׅ ˖ ַחז鸞䏝ָ何㊣ָׁ ֮ת㢳欽ׅה䕦갟ך⳿䛊ָ֮ ˖ "OHVMBS+4#BUBSBOHהְֲ$ISPNF堣腉䭁䓸⢪ג ػؿؓ٦وٝأָ孡חז鎘庠׃״ֲ ˖ +40/欰䧭儗ח؟٦غ⩎ד㢌䳔ׅקֲָ
僇ַח鸞ְךדծֿ銲嗚鎢 2. Filter
˖ ꬊず劍Ⳣ椚ך鍑寸䖉גַٕ٦ذ؍ؚٝⳢ椚遤ֲ"1* SFTPMWFחכ岣䠐 ˖ Ⳣ椚ָ$routeProviderה$POUSPMMFSדⴓꨄ׃ծ֮ה֮ה⥂㸚♳ד ٔأؙהז〳腉䚍ろ ˖ ثُ٦زٔ،ٕ鸐חSFTPMWF剅ְג׃תֲה ذأز׃חְֻ鎸鶢פ ˖
%JSFDUJWFDPOUSPMMFSך罋ִ倯דְֻז㉏겗הזחְֻ ˖ "OHVMBS6*3PVUFSהְֲ044֮ךד嗚鎢׃ג״ְַ 3. $routeProvider
˖ ׃ծך"OHVMBS6* ׯ⤑ⵃז؟٦سػ٦ذ؍٥ٓ؎ـָٓٔ "OHVMBS+4ךٔٔ٦أ٥أؾ٦سח㼎׃ג䗍㦩ח刿倜ָ鹼ְ ˖ וזךח鎉ִָծٓ؎ـٓٔך؝ىُصذ؍ך 崞䚍䏝װ刿倜걼䏝זָך䱰欽 ˖ 㹋ꥷծ"OHVMBS6*ח駈䲕תג׃לֻךתתד׃ ˖
֮ծד6*3PVUFSכ⮚猕דׅ 4. AngularUI
˖ ng-repeatװ%JSFDUJWFךcompile, link㢳欽׃גְה 넝然桦ד幉✉ׅ ˖ K2VFSZ⢘欽׃גٔحثז6*邌植׃״ֲ הַ䙼ְ㨣הծ劍䖉ׅ銲稆ָundefinedהַؠٓ ˖ אַתדכ嗚鏾ָ㣐㢌 ˖
⯓傈剢傈Ⱅ׃2JJUB"EWFOU$BMFOEBSך䬴鎸✲ חגծֿךװװֿ׃ְⳢ椚갫Ⰻגתהגְתׅ מ׀罋ח 5. directive処理順
ٌتٝAngularJS 8 عوוֿכ⯓➂ָعوג 縐䛊׆鹌
،ؐزٓ؎ٝ "OHVMBS+4Y禸ַ禸פ ⡦חぢְגְךַ 鋙ִקֲָ״ְךծ鋙ִזֻג״ְך 縐
涪橆㞮ך⢽
剑䖓ח猘⦐➂ך 涪橆㞮ך⢽稱➜׃ג 箍ֻֻתׅ ע꽀ֽ駈
圓䧭 4FSWFS OPEFKT &YQSFTT .POHP%# "OHVMBS+4 -PDBM.PEVMFT 6UJMJUJFT .PEFM JOKFDU
3&45"1*
ⴱ㔐כ HFOFSBUPSBOHVMBSGVMMTUBDL
植㖈ךر؍ؙٖزٔ root ├── Gruntfile.js ├── app │ ├── bower_components │
├── my_components │ │ └── * │ ├── my_modules │ │ └── * │ ├── favicon.ico │ ├── fonts │ ├── images │ ├── robots.txt │ ├── scripts │ │ ├── app.js │ │ ├── controllers │ │ ├── directives │ │ ├── filters │ │ ├── injectors │ │ ├── modules │ │ ├── routes.js │ │ ├── run.js │ │ └── services │ ├── styles │ │ ├── sass │ │ └── screen.css │ └── views │ ├── 404.html │ ├── index.html │ ├── partials │ └── parts ├── bower.json ├── common │ └── * ├── doc ├── e2e.conf.js ├── karma.conf.js │ ├── lib │ ├── bootstrap-models.js │ ├── config │ │ └── * │ ├── controllers │ │ └── * │ ├── middleware.js │ ├── models │ │ └── * │ └── routes.js ├── log ├── node_modules ├── package.json ├── server.js ├── test │ ├── client │ │ ├── e2e │ │ ├── mock │ │ └── spec │ └── server │ ├── mock │ └── spec ├── tsd.json └── typings ├── e2e.d.ts └── tsd.d.ts 㶵ָ㼭ֻׁגְׅתׇ
涪ך剑ⴱחװֿה ˖ ⡦״ؚٗ⳿⸂ת䲧ִ ˖ 䧭⸆٥㣟侁ろג宕竲涸ח婍ؚׅٗך⳿⸂הծ ؒٓ٦ךןחة٦ىشٕװـٓؐؠ٥؝ٝا٦ٕח 邌爙ׇׁؚٗワך⳿⸂ה侭䕎 ˖ OPEFKTך&YQSFTTה"OHVMBS+4חֶֽ"1*ך鸐⥋כ 暴ח稢ַֻ鎸ꐮ
˖ .POHP%#䪔ֲٓ؎ـٓٔ.POHPPTFָֿֿؚٗ ちֻךדծر٦ةك٦أ٥؝طؙءّٝתד鷿倯ח 凃ֿהכ㼰זַ
؝٦ر؍ؚٝ٥أة؎ٕ ˖ angular.module()ך剅ֹ倯הַծinjectך剅ֹ倯הַ זֲֽֿغٓغٓ ˖ 剑ⴱח鋅ثُ٦زٔ،ٕךأة؎ٕדךתת鹌ג׃תֲ؛٦أ ֿכהג⽬זְ ثُ٦زٔ،ٕכꞿ劍鏣鎘䠐陎׃גְזְ ˖ ؚؚ侧珏겲ך؝٦ر؍ؚٝ٥أة؎ָٕ⳿גֻ
BOHVMBSKTTUZMFHVJEF<嗚稊> ˖ ח䊴כָ֮ծⰟ鸐׃ג鶢ץגְ✲갪֮ךד ך鴟䖞ֲץֹ ˖ ⦐➂涸חכ function(){funtion(){function(){... ָ 㜔ִזְךדծ〳腉זꣲ䎂ח剅ְגְ ך倯ָꬊず劍窃ךذأزװ䊴׃剏ִ׃װְׅ
OQN CPXFS ˖ ZPBOHVMBSGVMMTUBDLָ欽䠐׃QBDLBHFKTك٦أח׃גְ ˖ ؝ىُصذ؍ך崧װ䐖גְזְַ鋅זָ傈ղ鑐遤ꐪ铎 ˖ OPEF@NPEVMFTכ express, lodash,
log4js, mongoose, mongoose-auto-increment, passport זו ˖ CPXFS@DPNQPOFOUTכ angular, angular-animate, angular-ui-bootstrap, d3, es5-shim, jquery, lodash, node-uuid, underscore.string זו
HSVOU ˖ ؽٕسخ٦ٕחכHSVOU⢪欽 ˖ &YQSFTT؟٦غך饯⹛װذأزծ؝ٝػ؎ٕזוծׅץגHSVOUח ⟣ׇגְ ˖ connect-livereload, grunt-este-watch, grunt-express-server,
grunt-karma, grunt-ng-annotate, grunt-ts, grunt-typedoc, karma, karma-phantomjs-launcher, load-grunt-tasks, protractor, time-gruntזו ˖ ♧⦐♧⦐铡僇דֹתׇָծJOKFDUך،ظذ٦ءّٝ鎸鶢荈⹛ ⻉ׅgrunt-ng-annotateכֶׅׅ
ذأز ˖ OPEFKT⩎כךתת.PDIB "OHVMBS+4⩎כ,BSNB 1IBOUPN+4 +BTNJOF ˖ "OHVMBS+4Ⱅ䒭דכذأز٥ؿٖ٦يٙ٦ؙח +BTNJOFגְָ.PDIBָ⹛ַזְֽדכזְ ˖
&&ذأز1SPUSBDUPSחꟼ׃גכ +BTNJOFח✲㹋♳ꣲ㹀ׁ ˖ ،؟٦ءّٝכQPXFSBTTFSU ٌحؙذأزכ4JOPO+4ծ+BTNJOF4QZ⢘欽 ➙䖓4JOPO+4⩎ח♧劤⻉׃״ֲה䙼גְ
㣐鋉垷⻉ך䝢ה鍑寸 ˖ 䎃דֲֽֿ花ד׃ת 植㖈♰遤קו瑞遤ծ؝ًٝزꤐֻ ˖ ذأزך㹋遤ָ鹼ַծמהאך%JSFDUJWFך嗚鏾ָ ⦜חזגֹծرًٔحزָ湡甧㨣 ˖ 琎噰涸ח㢩鿇ٌآُ٦ٕ⻉ծ(JUךٔهآزٔⴓֽ 㢌刿鷄ְװֻׅ׃ծذأزך顑⟣眔㔲ꣲ㹀׃
˖ ⦜ז㢩鿇ٌآُ٦ٕ⻉חכ:FPNBO(FOFSBUPS荈⡲׃⼱荈⹛⻉ ˖ 穠卓ծ何葺ׅץֹ挿ծ倜堣腉ך㹋鄲ծغؚ涪欰皘䨽ָ ּׅⴓַ״ֲחז؎؎ֿהלַדׅ 剑ⴱֲַׅץֹ
ٌتٝAngularJS 9 ػح؛٦آ盖椚ծؽٕسخ٦ٕד ؝ٝػؙزז㹋鄲ח㼔䙀
罋项俱٥鎸✲갫♶ず ˖ OHFVSPQFIUUQOHFVSPQFPSH ˖ "OHVMBS+4ؕٝؿ؋ٖٝأOHFVSPQFךأٓ؎سתה IUUQBOHVMBSKTOJOKBDPNCMPHTMJEFTBUOHFVSPQF ˖ 傈劤铂鏬OHFVSPQF "OHVMBS BOE#FZPOE
IUUQBOHVMBSKTOJOKBDPNCMPHOHFVSPQFBOHVMBSBOECFZPOEJOKBQBOFTF ˖ ⚅歲ך+BWB4DSJQU铣ֲIUUQB[VHJUIVCJPTMJEFKTFSKBWBTDSJQUIUNM ˖ 2JJUB]"OHVMBSًٌIUUQRJJUBDPNTIVIFJJUFNTCEDBBG ˖ #SBDFZPVSTFMWFT GVUVSFJTDPNJOH&4 "U4DSJQUBOE"OHVMBS IUUQCMPHMJOHPIVCDPNCSBDFGVUVSFDPNJOHFTBUTDSJQUBOHVMBS ˖ "OHVMBS+4ָ㱾ְIUUQNJ[DIJIBUFOBCMPHDPNFOUSZ ˖ "OHVMBS+4㱾ְז➂ָ㢳ְ僴➙חאְגIUUQCMPHQPSHFOUSZ ˖ "OHVMBS+4חאְגך䨽䠬IUUQIBWFMPHBZVNVTBUPDPNEFWFMPQKBWBTDSJQUFBOHVMBSKT@UIPVHIUIUNM ˖ ז"OHVMBS+4讂ךַ٦⦐➂涸ז䙼ְIUUQCMPHNJUTVSVPHJOGPBOHVMBSKTIUNM ˖ %BGU.POLHFOFSBUPSBOHVMBSGVMMTUBDLIUUQTHJUIVCDPN%BGU.POLHFOFSBUPSBOHVMBSGVMMTUBDL ˖ -*(⚺⪵ך"OHVMBS+4⹈䓼⠓OH$VSSZָ⪵ׁת׃IUUQMJHJODDPKQXFCKTPUIFSKT ˖ 5PEE.PUUPIUUQUPEENPUUPDPN ˖ UXBEBQPXFSBTTFSUIUUQTHJUIVCDPNUXBEBQPXFSBTTFSU
闐鳤 5ZQF4DSJQUٔؿ؋ٖٝأ ַתׁמ衼 "OHVMBS+4ٔؿ؋ٖٝأ 寑幐僇㸩ծꆃ❁⨳♧ծし歊䗡欰Ⱏ衼 劤闌怴ח荚תדծׁתׂתז׀䭷㼪갥ְַ孑ծ寑幐孑ח 䖴爝歍׃♳־ֻ闐鳤חִַׇׁגְֹתׅ
➙傈ך䗁统
ٌتٝAngularJS 1 ➙ַ&4俑岀ָ⢪ִ "OHVMBSث٦ي㛇燉ה׃ג䱰欽׃ 5ZQF4DSJQUד剅ֻ ٌتٝAngularJS 2 OHDPOUSPMMFS⢪׆ %JSFDUJWFDPOUSPMMFS欽ְ ٌتٝAngularJS
3 鋵㶨ד$TDPQFךⰟ剣כ⽬ꤹ ⡚穠さח⡲ ؎كٝز꽀⹛䠐陎 ٌتٝAngularJS 4 ,BSNB 1SPUSBDUPSד ذأز䫙ַזֻ ٌتٝAngularJS 5 "OHVMBSח⪒ִז %JSFDUJWF琎噰涸ח荈⡲ ٌتٝAngularJS 7 $PSF"1*⢪ְװֻׅٓحف 荈⡲4FSWJDFד Ⳣ椚ךꅾ醱鼘ֽ ٌتٝAngularJS 8 عوוֿכ⯓➂ָعوג 縐䛊׆鹌 ٌتٝAngularJS 9 ػح؛٦آ盖椚ծؽٕسخ٦ٕד ؝ٝػؙزז㹋鄲ח㼔䙀 ٌتٝAngularJS 6 'BDUPSZח״JOKFDU崞欽׃ג "OHVMBS+4"1* ⢪זְⳢ椚כ㢩פ
ٌتٝAngularJS 10 דכ Have a goodٌتٝAngularJS!
׀幠耮ָ֮הֲ׀ְׂת׃ %FD 痥㔐(%(⚥㕂⹈䓼⠓