Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
一些 Angular 的最佳实践
Search
Bin Xin
July 01, 2015
Programming
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
一些 Angular 的最佳实践
Bin Xin
July 01, 2015
Other Decks in Programming
See All in Programming
iOSDCのペンライトを自動制御したい!
akkeylab
0
330
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5.2k
AWSに止められる覚悟してますか?
morizo_1984
2
490
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
110
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
3.1k
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
250
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
290
setup-vp GitLab対応の裏側
naokihaba
0
140
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
180
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
380
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.3k
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
550
Building AI with AI
inesmontani
PRO
1
1.3k
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
300
Between Models and Reality
mayunak
4
480
GraphQLとの向き合い方2022年版
quramy
50
15k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
The Language of Interfaces
destraynor
162
27k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8k
Transcript
ӞԶ Angular ጱ๋֯ਫ ᪢ 2015.7 1
ֵአ ControllerAs դ๊ $scope <script> angular.module('app', []) .controller('FooCtrl', function ()
{ this.foo = 'this is foo' }) </script> <div ng-app="app" ng-controller="FooCtrl as ctrl"> {{ ctrl.foo }} </div> 2015.7 2
$scope.ctrl = new Ctrl see 2015.7 3
Pros • ӧᵱᥝׁᩢ $scope ဳف • හഝᬰᛔݷҁݷᑮᳵ҂҅عݒᰁ٫ᑱ • ݢզعӞԶଉᥠጱᔩᔊҁైአ$scope.$watch҂ •
ฃၥᦶ • ᶎݻ๚ҁAngular2҂ 2015.7 4
ࣁ Directive Ӥֵአ module.directive('fooBar', function () { return { scope:
{}, template: '{{ ctrl.foo }}', controllerAs: 'ctrl', controller: function () { this.foo = 'this is foobar directive' } } }) 2015.7 5
Directive ጱᳯ᷌ module.directive('fooBar', function () { return { scope: {
data: '=' }, template: '{{ ctrl.foo }} {{ ctrl.data.xx }}', controllerAs: 'ctrl', controller: function ($scope) { this.foo = 'this is foobar directive' // handle data var self = this $scope.$watch('data', function (data) { self.data = data }) } } }) 2015.7 6
bindToController!! 2015.7 7
ֵአ Directive ᕟᕢᶭᶎ 2015.7 8
2015.7 9
Pros • ᕟկ۸ • ᶎݻ๚ҁAngular2҂ 2015.7 10
عֵአ $scope ᱾ᬰᤈᕟկԏᳵጱԻ ᭗ᬦֵአ Serviceҁහഝ҂ ᘏ eventsҁ᭗ᦔ҂ 2015.7 11
$scope.$broadcast('addTask', list) $scope.$emit('createdTask', task) see 2015.7 12
Pros • ܔݻහഝၞ • flux • ӧᵱᥝփ handler҅$scope Ԟๅےଗٳ •
<foo on-save="ctrl.create(foo)"/> 2015.7 13
Router ng-click="router.forward('/folder')" 2015.7 14
href="/folder" see 2015.7 15
Pros • ݢᦢᳯ • ຽٵ۸ 2015.7 16
ཛྷࣘဳف // directives/foo.js return function ($scope, $timeout) { return {
scope: {} template: 'xxx' link: function () {} } } // module.js module.directive('foo', ['$scope', '$timeout', foo]) 2015.7 17
// directives/foo.js return ['$scope', '$timeout', function ($scope, $timeout) { return
{ scope: {} template: 'xxx' link: function () {} } }] // module.js module.directive('foo', foo) 2015.7 18
// directives/foo.js module.directive('foo', ['$scope', '$timeout', function ($scope, $timeout) { return
{ scope: {} template: 'xxx' link: function () {} } }]) 2015.7 19
Extra: token vs cookie 2015.7 20
2015.7 21
Pros • CORS • Stateless • ຽٵ۸ https://tools.ietf.org/html/rfc7519 • قᒒঅ
• ฃၥᦶ see 2015.7 22
Thanks • http://www.benlesh.com/2013/10/title.html • http://blog.thoughtram.io/angularjs/2015/01/02/exploring- angular-1.3-bindToController.html • http://jwt.io • https://auth0.com/blog/2014/01/07/angularjs-
authentication-with-cookies-vs-token/ 2015.7 23