ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
AngularJS
HTML ENHANCED FOR WEB APPS
   -   Patrick Aljord / @patcito
What Is AngularJS Trying To Fix?
HTML is great for declarative code for static web page
<>el wrd<p
pHlo ol!/>


              Not so for dynamic pages:
< i=getn1>/>
 p d"reig"<p
 <cit
  srp>
   vriI =dcmn.tahvn;
   a sE    ouetatcEet
   vraditnr=iI
   a dLsee    sE
    ?fnto(,t f){
       ucine , n
       eatcEet'n +t f)}
        .tahvn(o'  , n;
    :fnto(,t f){
       ucine , n
       eadvnLsee(,f,fle;;
        .dEetitnrt n as)}
   aditnrdcmn,'od,fnto({
   dLsee(ouet la' ucin)
    vrgetn =dcmn.eEeetyd'reig';
     a reig   ouetgtlmnBI(getn1)
    i (sE {
     f iI)
      getn.neTx ='el Wrd'
       reiginret  Hlo ol!;
    }es {
       le
      getn.etotn ='el Wrd'
       reigtxCnet  Hlo ol!;
    }
   };
   )
 <srp>
  /cit
But...

                 = Imperative :-(

     Declarative FTW!
1.    <>el wrd/>
       pHlo ol<p



2.    <>{reig}/>
       p{Getn}<p
Data Binding
1.   Define a model
2.   Binds it to a template
3.   When you modify the model, templates updates automotically
4.   When the user intereacts with the UI, templates knows how
     to sync the data with the model.
Concrete Example: JQuery Vs AngularJS
<cittp=tx/aacit>
srp ye"etjvsrp"
 $fnto ( {
 (ucin )
  vrnm =$'nm'.a(;
  a ae   (#ae)vl)
  vrgetn =$'getn';
  a reig   (#reig)

    nm.eu(ucin( {
     aekypfnto )
      getn.et'el ' nm +'';
       reigtx(Hlo + ae !)
    })
  })
<srp>
 /cit
<i>
 dv
<ae>ae<lbl
 lblNm:/ae>
<nu tp=tx"i=nm"
 ipt ye"et d"ae>
< i=getn"<p
 p d"reig>/>
<dv
 /i>



               Name:   Enter?a?name?here




                    HELLO
Concrete Example: JQuery Vs AngularJS
 <i n-p>
  dv gap
 <ae>ae<lbl
  lblNm:/ae>
 <nu tp=tx"n-oe=yuNm"
  ipt ye"et gmdl"orae>
 <>el {yuNm}!/>
  pHlo {orae}<p
 <dv
  /i>



           Name:   Enter?a?name?here




             HELLO !
SO DATA BINDING ALLOWS CODE THAT IS
   1. very simple
   2. very recognizable
   3. looks like the original HTML hello world
                   Thanks To...
    1.   Dirty checking
    2.   Only checks the current view
    3.   Only check when change may happen
    4.   Leverage the JIT
    5.   But... the DOM is slow
DATA BINDING COMING TO A BROWSER NEAR
                  YOU
                      Implementation When?
AngularJS             Javascript      Now
Model Driven Views Native             Future
Object.observe        Native          Future
  There's already an AngularJS branch using Object.observe !
BUT HTML CAN BE
   VERBOSE!
? Beatiful widgets: Cool
      Tricking the browser: Not Cool ??
  <lcas"a nvtb"i=mTb>
   u ls=nv a-as d"ya"
    <icas"cie>ahe=#eto1>eto 1/>/i
     l ls=atv"< rf"scin"Scin <a<l>
    <i< he=#rfl"Scin2/>/i
     l>a rf"poie>eto <a<l>
  <u>
   /l

  <i cas"a-otn"
   dv ls=tbcnet>
    <i cas"a-aeatv"i=scin"H,ImScin1/i
     dv ls=tbpn cie d"eto1>i ' eto <d
  v>
    <i cas"a-ae i=scin"H,ImScin2/i>
     dv ls=tbpn" d"eto2>i ' eto <dv
  <dv
   /i>

  <cit
   srp>
   $fnto ( {
    (ucin )
     $'mTbals'.a(so';
      (#ya :at)tb'hw)
   })
  <srp>
   /cit



Declarative reusable components:
             Cool ??
 <as
 tb>
  <aette"eto 1>
   pn il=Scin "
   H,ImScin1
    i ' eto
  <pn>
   /ae
  <aette"eto 2>
   pn il=Scin "
   H,ImScin2
    i ' eto
  <pn>
   /ae
 <tb>
 /as
<google-map>
           <tabs>
          <tweet>
          <avatar>
        <color-picker>
          <invoice>

<unleash-your-imagination>
REUSABLE COMPONENTS COMING TO A
            BROWSER NEAR YOU
             Implementation When?
AngularJS    DOM+JS         Now
             (directives)
Web          Native         Near Future
Components
Mozilla shim for web components: x-tags.org
W3C specs:
http://www.w3.org/TR/2012/WD-components-intro-
20120522/#custom-element-section
THE WHOLE PACKAGE
       TO BUILD KICK ASS WEB APPS!
  ? Data binding
  ? Templating
  ? Routing and deep linking
  ? Testing
  ? Form validation
  ? Dependency injection
  ? MVW (Model/View/Whatever!)
Introduction to AngularJS
angularjs scaffold
Checkout angularjs_scaffold if you're into Rails.
https://github.com/patcito/angularjs_scaffold
Thanks!
                   Patrick Aljord @patcito
                 http://blog.ricodigo.com
                 http://twitter.com/patcito
                 +Patrick Aljord




Credits for the slides: Vojta J¨ªna, Mi?ko Hevery, Igor Minar.
Introduction to AngularJS

More Related Content

What's hot (20)

Universal JavaScript
Universal JavaScriptUniversal JavaScript
Universal JavaScript
Ãû³½ ºé
?
Ellzey 5611 module 3
Ellzey 5611 module 3Ellzey 5611 module 3
Ellzey 5611 module 3
cellzey
?
Go Mobile with Apache Cordova, Zagreb 2014
Go Mobile with Apache Cordova, Zagreb 2014Go Mobile with Apache Cordova, Zagreb 2014
Go Mobile with Apache Cordova, Zagreb 2014
Christian Grobmeier
?
fabfile.py
fabfile.pyfabfile.py
fabfile.py
Corey Oordt
?
Web APIs you (probably) didn't know existed
Web APIs you (probably) didn't know existedWeb APIs you (probably) didn't know existed
Web APIs you (probably) didn't know existed
Zeno Rocha
?
Postman On Steroids
Postman On SteroidsPostman On Steroids
Postman On Steroids
Sara Tornincasa
?
World of Logging
World of LoggingWorld of Logging
World of Logging
Christian Grobmeier
?
One page app with AngularJS
One page app with AngularJSOne page app with AngularJS
One page app with AngularJS
Adam ?tip¨¢k
?
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
xSawyer
?
Wso2 esb-rest-integration
Wso2 esb-rest-integrationWso2 esb-rest-integration
Wso2 esb-rest-integration
Chanaka Fernando
?
?5???????????_???? ?? ??? ?? ??_???
?5???????????_???? ?? ??? ?? ??_????5???????????_???? ?? ??? ?? ??_???
?5???????????_???? ?? ??? ?? ??_???
daumfoundation
?
10 Catalyst Tips
10 Catalyst Tips10 Catalyst Tips
10 Catalyst Tips
Jay Shirley
?
Any event intro
Any event introAny event intro
Any event intro
qiang
?
Document
DocumentDocument
Document
viwviw
?
Make WordPress realtime.
Make WordPress realtime.Make WordPress realtime.
Make WordPress realtime.
Josh Hillier
?
Zen: Building Maintainable Catalyst Applications
Zen: Building Maintainable Catalyst ApplicationsZen: Building Maintainable Catalyst Applications
Zen: Building Maintainable Catalyst Applications
Jay Shirley
?
¥ì¥Ã¥Ä¥´©`¥Ç¥Ù¥í¥Ã¥Ñ©`2011¡¸¥×¥í¥°¥é¥ß¥ó¥°³Ò°ù´Ç´Ç±¹²â?³Ò*¥¨¥³¥·¥¹¥Æ¥à±à¡¹
¥ì¥Ã¥Ä¥´©`¥Ç¥Ù¥í¥Ã¥Ñ©`2011¡¸¥×¥í¥°¥é¥ß¥ó¥°³Ò°ù´Ç´Ç±¹²â?³Ò*¥¨¥³¥·¥¹¥Æ¥à±à¡¹¥ì¥Ã¥Ä¥´©`¥Ç¥Ù¥í¥Ã¥Ñ©`2011¡¸¥×¥í¥°¥é¥ß¥ó¥°³Ò°ù´Ç´Ç±¹²â?³Ò*¥¨¥³¥·¥¹¥Æ¥à±à¡¹
¥ì¥Ã¥Ä¥´©`¥Ç¥Ù¥í¥Ã¥Ñ©`2011¡¸¥×¥í¥°¥é¥ß¥ó¥°³Ò°ù´Ç´Ç±¹²â?³Ò*¥¨¥³¥·¥¹¥Æ¥à±à¡¹
Yasuharu Nakano
?
Islam House
Islam HouseIslam House
Islam House
Haris Padinharethil
?
jQuery
jQueryjQuery
jQuery
Andrew Homeyer
?
You promise?
You promise?You promise?
You promise?
IT Weekend
?
Ellzey 5611 module 3
Ellzey 5611 module 3Ellzey 5611 module 3
Ellzey 5611 module 3
cellzey
?
Go Mobile with Apache Cordova, Zagreb 2014
Go Mobile with Apache Cordova, Zagreb 2014Go Mobile with Apache Cordova, Zagreb 2014
Go Mobile with Apache Cordova, Zagreb 2014
Christian Grobmeier
?
Web APIs you (probably) didn't know existed
Web APIs you (probably) didn't know existedWeb APIs you (probably) didn't know existed
Web APIs you (probably) didn't know existed
Zeno Rocha
?
One page app with AngularJS
One page app with AngularJSOne page app with AngularJS
One page app with AngularJS
Adam ?tip¨¢k
?
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
xSawyer
?
?5???????????_???? ?? ??? ?? ??_???
?5???????????_???? ?? ??? ?? ??_????5???????????_???? ?? ??? ?? ??_???
?5???????????_???? ?? ??? ?? ??_???
daumfoundation
?
Any event intro
Any event introAny event intro
Any event intro
qiang
?
Make WordPress realtime.
Make WordPress realtime.Make WordPress realtime.
Make WordPress realtime.
Josh Hillier
?
Zen: Building Maintainable Catalyst Applications
Zen: Building Maintainable Catalyst ApplicationsZen: Building Maintainable Catalyst Applications
Zen: Building Maintainable Catalyst Applications
Jay Shirley
?
¥ì¥Ã¥Ä¥´©`¥Ç¥Ù¥í¥Ã¥Ñ©`2011¡¸¥×¥í¥°¥é¥ß¥ó¥°³Ò°ù´Ç´Ç±¹²â?³Ò*¥¨¥³¥·¥¹¥Æ¥à±à¡¹
¥ì¥Ã¥Ä¥´©`¥Ç¥Ù¥í¥Ã¥Ñ©`2011¡¸¥×¥í¥°¥é¥ß¥ó¥°³Ò°ù´Ç´Ç±¹²â?³Ò*¥¨¥³¥·¥¹¥Æ¥à±à¡¹¥ì¥Ã¥Ä¥´©`¥Ç¥Ù¥í¥Ã¥Ñ©`2011¡¸¥×¥í¥°¥é¥ß¥ó¥°³Ò°ù´Ç´Ç±¹²â?³Ò*¥¨¥³¥·¥¹¥Æ¥à±à¡¹
¥ì¥Ã¥Ä¥´©`¥Ç¥Ù¥í¥Ã¥Ñ©`2011¡¸¥×¥í¥°¥é¥ß¥ó¥°³Ò°ù´Ç´Ç±¹²â?³Ò*¥¨¥³¥·¥¹¥Æ¥à±à¡¹
Yasuharu Nakano
?

Viewers also liked (15)

Presentation sanlab workshops
Presentation sanlab workshopsPresentation sanlab workshops
Presentation sanlab workshops
Artur Roszczyk
?
JWEF Singapore - Building a company for fun, by Keith Ng, Gametize
JWEF Singapore - Building a company for fun, by Keith Ng, GametizeJWEF Singapore - Building a company for fun, by Keith Ng, Gametize
JWEF Singapore - Building a company for fun, by Keith Ng, Gametize
Keith Ng (@keizng)
?
Fun day
Fun dayFun day
Fun day
serkan yesilba?
?
Our teaser trailer idea final
Our teaser trailer idea finalOur teaser trailer idea final
Our teaser trailer idea final
amylewissimon1
?
Trailer analysis toy story 3
Trailer analysis   toy story 3Trailer analysis   toy story 3
Trailer analysis toy story 3
Fordyy
?
Our teaser trailer idea final
Our teaser trailer idea finalOur teaser trailer idea final
Our teaser trailer idea final
amylewissimon1
?
Team Building Company Brochure 2011
Team Building Company Brochure 2011Team Building Company Brochure 2011
Team Building Company Brochure 2011
The Team Building Company
?
Event management software market teaser
Event management software market teaserEvent management software market teaser
Event management software market teaser
sukiennong.vn
?
Corporate events presentation
Corporate events presentationCorporate events presentation
Corporate events presentation
globedu
?
Corporate events ppt
Corporate events pptCorporate events ppt
Corporate events ppt
TheBSIIndia
?
Events Marketing
Events MarketingEvents Marketing
Events Marketing
Nj Lopez-Tan
?
Gapingvoid: How To Supercharge Your Event
Gapingvoid: How To Supercharge Your EventGapingvoid: How To Supercharge Your Event
Gapingvoid: How To Supercharge Your Event
Gapingvoid Culture Design Group
?
Content Marketing for EventsContent Marketing for Events
Content Marketing for Events
Joe Pulizzi
?
Event planning powerpoint
Event planning powerpointEvent planning powerpoint
Event planning powerpoint
katelandturner
?
Fun Is Good Ppt
Fun Is  Good PptFun Is  Good Ppt
Fun Is Good Ppt
university of indianapolis
?
Presentation sanlab workshops
Presentation sanlab workshopsPresentation sanlab workshops
Presentation sanlab workshops
Artur Roszczyk
?
JWEF Singapore - Building a company for fun, by Keith Ng, Gametize
JWEF Singapore - Building a company for fun, by Keith Ng, GametizeJWEF Singapore - Building a company for fun, by Keith Ng, Gametize
JWEF Singapore - Building a company for fun, by Keith Ng, Gametize
Keith Ng (@keizng)
?
Our teaser trailer idea final
Our teaser trailer idea finalOur teaser trailer idea final
Our teaser trailer idea final
amylewissimon1
?
Trailer analysis toy story 3
Trailer analysis   toy story 3Trailer analysis   toy story 3
Trailer analysis toy story 3
Fordyy
?
Our teaser trailer idea final
Our teaser trailer idea finalOur teaser trailer idea final
Our teaser trailer idea final
amylewissimon1
?
Event management software market teaser
Event management software market teaserEvent management software market teaser
Event management software market teaser
sukiennong.vn
?
Corporate events presentation
Corporate events presentationCorporate events presentation
Corporate events presentation
globedu
?
Corporate events ppt
Corporate events pptCorporate events ppt
Corporate events ppt
TheBSIIndia
?
Content Marketing for EventsContent Marketing for Events
Content Marketing for Events
Joe Pulizzi
?
Event planning powerpoint
Event planning powerpointEvent planning powerpoint
Event planning powerpoint
katelandturner
?

Similar to Introduction to AngularJS (20)

Angular.js + Rails at WeWork or: The Accidental Feature
Angular.js + Rails at WeWork or: The Accidental FeatureAngular.js + Rails at WeWork or: The Accidental Feature
Angular.js + Rails at WeWork or: The Accidental Feature
Jonathan Magen
?
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET DevelopersAccelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Todd Anglin
?
Using Ember to Make a Bazillion Dollars
Using Ember to Make a Bazillion DollarsUsing Ember to Make a Bazillion Dollars
Using Ember to Make a Bazillion Dollars
Mike Pack
?
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
Jamie Matthews
?
Velocity EU 2012 - Third party scripts and you
Velocity EU 2012 - Third party scripts and youVelocity EU 2012 - Third party scripts and you
Velocity EU 2012 - Third party scripts and you
Patrick Meenan
?
Crossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end FrameworkCrossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end Framework
Daniel Spector
?
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
Igor Bronovskyy
?
Charlie Gerard- Mind Control in Javascript (Evolution)
Charlie Gerard- Mind Control in Javascript (Evolution)Charlie Gerard- Mind Control in Javascript (Evolution)
Charlie Gerard- Mind Control in Javascript (Evolution)
Thoughtworks
?
Ç°¶Ë¸ÅÊö
Ç°¶Ë¸ÅÊöÇ°¶Ë¸ÅÊö
Ç°¶Ë¸ÅÊö
Ethan Zhang
?
jQuery Internals + Cool Stuff
jQuery Internals + Cool StuffjQuery Internals + Cool Stuff
jQuery Internals + Cool Stuff
jeresig
?
The State of PHPUnit
The State of PHPUnitThe State of PHPUnit
The State of PHPUnit
Edorian
?
Frontin like-a-backer
Frontin like-a-backerFrontin like-a-backer
Frontin like-a-backer
Frank de Jonge
?
Liberating web apps from the server
Liberating web apps from the serverLiberating web apps from the server
Liberating web apps from the server
Alexander Gyoshev
?
The Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web appsThe Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web apps
John Anderson
?
REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and Python
PiXeL16
?
He stopped using for/while loops, you won't believe what happened next!
He stopped using for/while loops, you won't believe what happened next!He stopped using for/while loops, you won't believe what happened next!
He stopped using for/while loops, you won't believe what happened next!
Fran?ois-Guillaume Ribreau
?
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patterns
Stoyan Stefanov
?
Starting out with Ember.js
Starting out with Ember.jsStarting out with Ember.js
Starting out with Ember.js
Anirudh Shivanand
?
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
Marcus Ramberg
?
Web performance essentials - Goodies
Web performance essentials - GoodiesWeb performance essentials - Goodies
Web performance essentials - Goodies
Jerry Emmanuel
?
Angular.js + Rails at WeWork or: The Accidental Feature
Angular.js + Rails at WeWork or: The Accidental FeatureAngular.js + Rails at WeWork or: The Accidental Feature
Angular.js + Rails at WeWork or: The Accidental Feature
Jonathan Magen
?
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET DevelopersAccelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Accelerated Adoption: HTML5 and CSS3 for ASP.NET Developers
Todd Anglin
?
Using Ember to Make a Bazillion Dollars
Using Ember to Make a Bazillion DollarsUsing Ember to Make a Bazillion Dollars
Using Ember to Make a Bazillion Dollars
Mike Pack
?
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
Five Pound App talk: hereit.is, Web app architecture, REST, CSS3
Jamie Matthews
?
Velocity EU 2012 - Third party scripts and you
Velocity EU 2012 - Third party scripts and youVelocity EU 2012 - Third party scripts and you
Velocity EU 2012 - Third party scripts and you
Patrick Meenan
?
Crossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end FrameworkCrossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end Framework
Daniel Spector
?
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
Igor Bronovskyy
?
Charlie Gerard- Mind Control in Javascript (Evolution)
Charlie Gerard- Mind Control in Javascript (Evolution)Charlie Gerard- Mind Control in Javascript (Evolution)
Charlie Gerard- Mind Control in Javascript (Evolution)
Thoughtworks
?
jQuery Internals + Cool Stuff
jQuery Internals + Cool StuffjQuery Internals + Cool Stuff
jQuery Internals + Cool Stuff
jeresig
?
The State of PHPUnit
The State of PHPUnitThe State of PHPUnit
The State of PHPUnit
Edorian
?
Liberating web apps from the server
Liberating web apps from the serverLiberating web apps from the server
Liberating web apps from the server
Alexander Gyoshev
?
The Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web appsThe Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web apps
John Anderson
?
REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and Python
PiXeL16
?
He stopped using for/while loops, you won't believe what happened next!
He stopped using for/while loops, you won't believe what happened next!He stopped using for/while loops, you won't believe what happened next!
He stopped using for/while loops, you won't believe what happened next!
Fran?ois-Guillaume Ribreau
?
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patterns
Stoyan Stefanov
?
Web performance essentials - Goodies
Web performance essentials - GoodiesWeb performance essentials - Goodies
Web performance essentials - Goodies
Jerry Emmanuel
?

Introduction to AngularJS

  • 1. AngularJS HTML ENHANCED FOR WEB APPS - Patrick Aljord / @patcito
  • 2. What Is AngularJS Trying To Fix? HTML is great for declarative code for static web page <>el wrd<p pHlo ol!/> Not so for dynamic pages: < i=getn1>/> p d"reig"<p <cit srp> vriI =dcmn.tahvn; a sE ouetatcEet vraditnr=iI a dLsee sE ?fnto(,t f){ ucine , n eatcEet'n +t f)} .tahvn(o' , n; :fnto(,t f){ ucine , n eadvnLsee(,f,fle;; .dEetitnrt n as)} aditnrdcmn,'od,fnto({ dLsee(ouet la' ucin) vrgetn =dcmn.eEeetyd'reig'; a reig ouetgtlmnBI(getn1) i (sE { f iI) getn.neTx ='el Wrd' reiginret Hlo ol!; }es { le getn.etotn ='el Wrd' reigtxCnet Hlo ol!; } }; ) <srp> /cit
  • 3. But... = Imperative :-( Declarative FTW! 1. <>el wrd/> pHlo ol<p 2. <>{reig}/> p{Getn}<p
  • 4. Data Binding 1. Define a model 2. Binds it to a template 3. When you modify the model, templates updates automotically 4. When the user intereacts with the UI, templates knows how to sync the data with the model.
  • 5. Concrete Example: JQuery Vs AngularJS <cittp=tx/aacit> srp ye"etjvsrp" $fnto ( { (ucin ) vrnm =$'nm'.a(; a ae (#ae)vl) vrgetn =$'getn'; a reig (#reig) nm.eu(ucin( { aekypfnto ) getn.et'el ' nm +''; reigtx(Hlo + ae !) }) }) <srp> /cit <i> dv <ae>ae<lbl lblNm:/ae> <nu tp=tx"i=nm" ipt ye"et d"ae> < i=getn"<p p d"reig>/> <dv /i> Name: Enter?a?name?here HELLO
  • 6. Concrete Example: JQuery Vs AngularJS <i n-p> dv gap <ae>ae<lbl lblNm:/ae> <nu tp=tx"n-oe=yuNm" ipt ye"et gmdl"orae> <>el {yuNm}!/> pHlo {orae}<p <dv /i> Name: Enter?a?name?here HELLO !
  • 7. SO DATA BINDING ALLOWS CODE THAT IS 1. very simple 2. very recognizable 3. looks like the original HTML hello world Thanks To... 1. Dirty checking 2. Only checks the current view 3. Only check when change may happen 4. Leverage the JIT 5. But... the DOM is slow
  • 8. DATA BINDING COMING TO A BROWSER NEAR YOU Implementation When? AngularJS Javascript Now Model Driven Views Native Future Object.observe Native Future There's already an AngularJS branch using Object.observe !
  • 9. BUT HTML CAN BE VERBOSE!
  • 10. ? Beatiful widgets: Cool Tricking the browser: Not Cool ?? <lcas"a nvtb"i=mTb> u ls=nv a-as d"ya" <icas"cie>ahe=#eto1>eto 1/>/i l ls=atv"< rf"scin"Scin <a<l> <i< he=#rfl"Scin2/>/i l>a rf"poie>eto <a<l> <u> /l <i cas"a-otn" dv ls=tbcnet> <i cas"a-aeatv"i=scin"H,ImScin1/i dv ls=tbpn cie d"eto1>i ' eto <d v> <i cas"a-ae i=scin"H,ImScin2/i> dv ls=tbpn" d"eto2>i ' eto <dv <dv /i> <cit srp> $fnto ( { (ucin ) $'mTbals'.a(so'; (#ya :at)tb'hw) }) <srp> /cit Declarative reusable components: Cool ?? <as tb> <aette"eto 1> pn il=Scin " H,ImScin1 i ' eto <pn> /ae <aette"eto 2> pn il=Scin " H,ImScin2 i ' eto <pn> /ae <tb> /as
  • 11. <google-map> <tabs> <tweet> <avatar> <color-picker> <invoice> <unleash-your-imagination>
  • 12. REUSABLE COMPONENTS COMING TO A BROWSER NEAR YOU Implementation When? AngularJS DOM+JS Now (directives) Web Native Near Future Components
  • 13. Mozilla shim for web components: x-tags.org W3C specs: http://www.w3.org/TR/2012/WD-components-intro- 20120522/#custom-element-section
  • 14. THE WHOLE PACKAGE TO BUILD KICK ASS WEB APPS! ? Data binding ? Templating ? Routing and deep linking ? Testing ? Form validation ? Dependency injection ? MVW (Model/View/Whatever!)
  • 16. angularjs scaffold Checkout angularjs_scaffold if you're into Rails. https://github.com/patcito/angularjs_scaffold
  • 17. Thanks! Patrick Aljord @patcito http://blog.ricodigo.com http://twitter.com/patcito +Patrick Aljord Credits for the slides: Vojta J¨ªna, Mi?ko Hevery, Igor Minar.