SlideShare a Scribd company logo
ANGULARJS SHARING
Tom Chen @ House123
13年10月7⽇日星期⼀一
hihi
13年10月7⽇日星期⼀一
Tom Chen
Full stack web engineer
python/js/CSS/HTML
Photoshop
Linux/FreeBSD/SQL/AWS
Music
keyboard/vocal
13年10月7⽇日星期⼀一
最近其實都在寫 backend orz
13年10月7⽇日星期⼀一
今天的 sharing 不會太⻑⾧長 orz
13年10月7⽇日星期⼀一
真的不多,所以,有任何問題
請直接打斷 XD
13年10月7⽇日星期⼀一
後⾯面留了很多時間交流 :D
13年10月7⽇日星期⼀一
讓我了解⼀一下現場組成...
13年10月7⽇日星期⼀一
Front End Engineer
13年10月7⽇日星期⼀一
Back End Developer
13年10月7⽇日星期⼀一
others?
13年10月7⽇日星期⼀一
我也是初學者
13年10月7⽇日星期⼀一
來跟⼤大家分享⼀一點微薄的經驗
13年10月7⽇日星期⼀一
為什麼會接觸到 AngularJS?
13年10月7⽇日星期⼀一
Pick the BEST solution
13年10月7⽇日星期⼀一
某公司網站,前台後台
可以上更新新聞、有⼀一些⾏行事曆
13年10月7⽇日星期⼀一
某公司網站,前台後台
可以上更新新聞、有⼀一些⾏行事曆
13年10月7⽇日星期⼀一
某公司網站,前台後台
可以上更新新聞、有⼀一些⾏行事曆
⼀一週搞定?
13年10月7⽇日星期⼀一
某公司網站,前台後台
可以上更新新聞、有⼀一些⾏行事曆
⼀一週搞定?
13年10月7⽇日星期⼀一
Application over the web?
13年10月7⽇日星期⼀一
http://houz.tw
13年10月7⽇日星期⼀一
Application over the web?
13年10月7⽇日星期⼀一
Application over the web?
load 太慢
13年10月7⽇日星期⼀一
Application over the web?
load 太慢
fu 不對
13年10月7⽇日星期⼀一
Application over the web?
13年10月7⽇日星期⼀一
Application over the web?
太 raw
13年10月7⽇日星期⼀一
Application over the web?
太 raw
⾃自⼰己刻太多東⻄西
13年10月7⽇日星期⼀一
Application over the web?
13年10月7⽇日星期⼀一
Application over the web?
13年10月7⽇日星期⼀一
A Comparison of Angular, Backbone, CanJS and Ember
http://sporto.github.io/blog/2013/04/12/comparison-angular-backbone-can-ember/
Is Angular.js or Ember.js the better choice for Javascript frameworks?
http://www.quora.com/Client-side-MVC/Is-Angular-js-or-Ember-js-the-better-choice-for-Javascript-
frameworks?utm_source=javascriptweekly&utm_medium=email
13年10月7⽇日星期⼀一
碰到最⼤大的問題?
13年10月7⽇日星期⼀一
13年10月7⽇日星期⼀一
Document Sucks!
13年10月7⽇日星期⼀一
Learning Curve 太陡峭
13年10月7⽇日星期⼀一
Learn AngularJS from the best
http://www.thinkster.io/
13年10月7⽇日星期⼀一
AngularJS Sticky Notes
http://onehungrymind.com/angularjs-sticky-notes-pt-1-architecture/
13年10月7⽇日星期⼀一
Think in AngularJS!
How do I “think in AngularJS” if I have a jQuery background?
http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background/
15012542#15012542
我記得有⼀一個連結在 github or gist 上,關於這個主題,但我⼀一時之間找不到了
13年10月7⽇日星期⼀一
template 沒有 if else
不習慣 orz
<div	
  ng-­‐show="showmemos	
  &&	
  house.memo.length	
  >	
  0"	
  class="memos">
	
  	
  	
  	
  <div	
  ng-­‐repeat="memo	
  in	
  house.memo"	
  class="memo-­‐item">
	
  	
  	
  	
  	
  	
  	
  	
  <div	
  ng-­‐show="!memo.edit">
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {{	
  memo.memo	
  }}	
  –	
  <span	
  class="timestamp">{{	
  memo.create_time	
  }}</span>
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <ul	
  class="controls">
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <li><a	
  href=""	
  ng-­‐click="edit_memo(house,	
  memo)">編輯</a></li>
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <li><a	
  href=""	
  ng-­‐click="remove_memo(house,	
  memo)">刪除</a></li>
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  </ul>
	
  	
  	
  	
  	
  	
  	
  	
  </div>
	
  	
  	
  	
  	
  	
  	
  	
  <div	
  ng-­‐show="memo.edit"	
  class="edit">
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <textarea	
  ng-­‐model="memo.memo"	
  edit-­‐focus="memo.id"></textarea>
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <ul	
  class="controls">
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <li><a	
  href=""	
  ng-­‐click="cancel_edit_memo(house,	
  memo)">取消</a></li>
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <li><a	
  href=""	
  ng-­‐click="confirm_edit_memo(house,	
  memo)">完成</a></li>
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  </ul>
	
  	
  	
  	
  	
  	
  	
  	
  </div>
	
  	
  	
  	
  </div>
</div>
13年10月7⽇日星期⼀一
jQuery 很簡單的,AngularJS 複雜
OMG
.directive('ngFocus',	
  function($parse)	
  {
	
  	
  	
  	
  return	
  function(scope,	
  element,	
  attrs)	
  {
	
  	
  	
  	
  	
  	
  	
  	
  var	
  fn	
  =	
  $parse(attrs['ngFocus']);
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  element.bind('focus',	
  function(event)	
  {
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  scope.$apply(function()	
  {
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  fn(scope,	
  {$event:	
  event});
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  });
	
  	
  	
  	
  	
  	
  	
  	
  });
	
  	
  	
  	
  };
})
<span	
  class="controls">
	
  	
  	
  	
  <input	
  type="text"	
  ng-­‐model="facet.custom.from"	
  ng-­‐focus="onFocus(facet)"	
  />	
  -­‐	
  
	
  	
  	
  	
  <input	
  type="text"	
  ng-­‐model="facet.custom.to"	
  />	
  {{	
  facet.unit	
  }}
	
  	
  	
  	
  <a	
  class="apply"	
  href=""	
  ng-­‐click="applyCustom(facet)">套⽤用</a>
	
  	
  	
  	
  <a	
  class="apply"	
  href=""	
  ng-­‐click="clearCustom(facet)">清除</a>
</span>
13年10月7⽇日星期⼀一
django & nginx
django
static
3rd_party/angularJS
js/angular
templates
dynamic handlers
(ajax handlers, other pages)
nginx
static
nginx
proxy
nginx
13年10月7⽇日星期⼀一
authentication
想破頭....
https://github.com/witoldsz/angular-http-auth
Typical use case:
• somewhere the: $http(...).then(function(response) { do-
something-with-response }) is invoked,
• the response of that requests is a HTTP 401,
• 'http-auth-interceptor' captures the initial request and broadcasts
'event:auth-loginRequired',
• your application intercepts this to e.g. show a login dialog (or whatever else),
• once your application figures out the authentication is OK, you are to call:
authService.loginConfirmed(),
• your initial failed request will now be retried and finally, the do-
something-with-response will fire.
13年10月7⽇日星期⼀一
authentication
想破頭....
https://github.com/witoldsz/angular-http-auth
login required 時,直接導到 login page
login page might not be AngularJS
13年10月7⽇日星期⼀一
好處?
13年10月7⽇日星期⼀一
two way data binding
13年10月7⽇日星期⼀一
template
13年10月7⽇日星期⼀一
MVC structure
13年10月7⽇日星期⼀一
AngularStrap
http://mgcrea.github.io/angular-strap/
13年10月7⽇日星期⼀一
AngularJS style guide
https://github.com/mgechev/angularjs-style-guide
13年10月7⽇日星期⼀一
Questions?
13年10月7⽇日星期⼀一

More Related Content

PPT
m.taobao.com for iPhone&Android Optimization
PPT
FIM Media Player - BoxModel in Flash
PPT
javascript的分层概念 --- 阿当
PDF
下载 《! #$%》&'()-+,-._01
PDF
Writing skills for Information Technology
PDF
如何实现登出按钮
PPT
让我们的页面跑得更快
PDF
一拍一产品背后的故事(React实战)
m.taobao.com for iPhone&Android Optimization
FIM Media Player - BoxModel in Flash
javascript的分层概念 --- 阿当
下载 《! #$%》&'()-+,-._01
Writing skills for Information Technology
如何实现登出按钮
让我们的页面跑得更快
一拍一产品背后的故事(React实战)

What's hot (6)

PPT
Puti
PPT
Web安全解决方案V1.0
PPT
Web base 吴志华
PPT
J Query简介及入门指南
PPT
关于Js的跨域操作
PPT
Mongodb
 
Puti
Web安全解决方案V1.0
Web base 吴志华
J Query简介及入门指南
关于Js的跨域操作
Mongodb
 
Ad

Viewers also liked (20)

PDF
Command line 初級寶典
PPS
Xmas
PDF
Pytables
PDF
Live Performance Effects
PDF
真蝦意外接到的Case
PDF
Two scoops of Django - Deployment
PPTX
Two scoops of django Introduction
PDF
Elasticsearch intro output
PDF
Django step0
PPTX
Gitlab
PDF
Working with the django admin
PDF
愛樂工程師
PDF
Django 實戰 - 自己的購物網站自己做
PDF
Integrating tornado and webpack
PDF
那些年,我用 Django Admin 接的案子
PDF
Learning django step 1
PDF
Python RESTful webservices with Python: Flask and Django solutions
PDF
Django workshop homework 3
PDF
Scalable Django Architecture
PDF
解密解密
Command line 初級寶典
Xmas
Pytables
Live Performance Effects
真蝦意外接到的Case
Two scoops of Django - Deployment
Two scoops of django Introduction
Elasticsearch intro output
Django step0
Gitlab
Working with the django admin
愛樂工程師
Django 實戰 - 自己的購物網站自己做
Integrating tornado and webpack
那些年,我用 Django Admin 接的案子
Learning django step 1
Python RESTful webservices with Python: Flask and Django solutions
Django workshop homework 3
Scalable Django Architecture
解密解密
Ad

Recently uploaded (20)

PPTX
3分钟读懂皇家艺术学院毕业证RCA毕业证学历认证
PDF
想要安全提高成绩?我们的黑客技术采用深度伪装和多层加密手段,确保你的信息安全无忧。价格公道,流程简单,同时提供全面的信息保护和事后痕迹清理,让你轻松提升G...
PPTX
模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板
PPTX
3分钟读懂纽曼大学毕业证Newman毕业证学历认证
PPTX
3分钟读懂滑铁卢大学毕业证Waterloo毕业证学历认证
PDF
黑客出手,分数我有!安全可靠的技术支持,让你的GPA瞬间提升,留学之路更加顺畅!【微信:viphuzhao】
PPTX
3分钟读懂诺里奇艺术大学毕业证NUA毕业证学历认证
PPTX
3分钟读懂伦敦南岸大学毕业证LSBU毕业证学历认证
PPTX
3分钟读懂拉夫堡大学毕业证LU毕业证学历认证
PPTX
3分钟读懂圭尔夫大学毕业证U of G毕业证学历认证
PPTX
3分钟读懂利物浦约翰摩尔大学毕业证LJMU毕业证学历认证
PPTX
ONU and OLT from Baudcom Jenny training PPT
PPTX
3分钟读懂索尔福德大学毕业证Salford毕业证学历认证
PPTX
《HSK标准教程4下》第15课课件new.pptx HSK chapter 15 pptx
PPTX
3分钟读懂曼彻斯特城市大学毕业证MMU毕业证学历认证
PDF
01_Course_Introduction(20210916課後更新).pdf
PPTX
3分钟读懂肯塔基大学毕业证UK毕业证学历认证
PPTX
3分钟读懂伦敦大学学院毕业证UCL毕业证学历认证
PPTX
3分钟读懂贵湖大学毕业证U of G毕业证学历认证
PPTX
3分钟读懂曼彻斯特大学毕业证UoM毕业证学历认证
3分钟读懂皇家艺术学院毕业证RCA毕业证学历认证
想要安全提高成绩?我们的黑客技术采用深度伪装和多层加密手段,确保你的信息安全无忧。价格公道,流程简单,同时提供全面的信息保护和事后痕迹清理,让你轻松提升G...
模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板模板
3分钟读懂纽曼大学毕业证Newman毕业证学历认证
3分钟读懂滑铁卢大学毕业证Waterloo毕业证学历认证
黑客出手,分数我有!安全可靠的技术支持,让你的GPA瞬间提升,留学之路更加顺畅!【微信:viphuzhao】
3分钟读懂诺里奇艺术大学毕业证NUA毕业证学历认证
3分钟读懂伦敦南岸大学毕业证LSBU毕业证学历认证
3分钟读懂拉夫堡大学毕业证LU毕业证学历认证
3分钟读懂圭尔夫大学毕业证U of G毕业证学历认证
3分钟读懂利物浦约翰摩尔大学毕业证LJMU毕业证学历认证
ONU and OLT from Baudcom Jenny training PPT
3分钟读懂索尔福德大学毕业证Salford毕业证学历认证
《HSK标准教程4下》第15课课件new.pptx HSK chapter 15 pptx
3分钟读懂曼彻斯特城市大学毕业证MMU毕业证学历认证
01_Course_Introduction(20210916課後更新).pdf
3分钟读懂肯塔基大学毕业证UK毕业证学历认证
3分钟读懂伦敦大学学院毕业证UCL毕业证学历认证
3分钟读懂贵湖大学毕业证U of G毕业证学历认证
3分钟读懂曼彻斯特大学毕业证UoM毕业证学历认证

AngularJS Sharing