SlideShare una empresa de Scribd logo
1 de 38
Descargar para leer sin conexión
EMBER.JS
Raphaël Rougeron / @goldoraf
MAIS QU'EST-CE ?
ember.js est un framework MVC pour le développement
 de Single Page Apps, né des cendres de Sproutcore...
                Version stable : 0.9.8.1
                Dernière version : 1.0.0-pre2
QUI L'UTILISE ?
MODÈLE OBJET
ApTd =EbrOjc.xed{
 p.oo   me.betetn(
   tte nl,
    il: ul
   cmltd fle
    opee: as,

     cmlt:fnto( {
      opee ucin)
       ti.e(cmltd,tu)
        hsst'opee' re;
     }
};
 )

vrtd =ApTd.rae{
 a oo   p.oocet(
   tte 'cee d pi'
    il: Ahtr u an
};
 )
cnoelgtd.e(tte);
 osl.o(oogt'il')
td.e(cmltd,tu)
 oost'opee' re;
HÉRITAGE
ApTs =ApTd.xed{
 p.ak   p.ooetn(
   det nl,
    uA: ul
   cmltdt nl,
    opeeA: ul

     cmlt:fnto( {
      opee ucin)
       ti.spr)
        hs_ue(;
       ti.e(cmltdt,nwDt()
        hsst'opeeA' e ae);
     }
};
 )
RÉOUVERTURE D'INSTANCES
ApTs.epn{
 p.akroe(
   asge:nl
    sine ul
};
 )




    RÉOUVERTURE DE "CLASSES"
ApTs.epnls(
 p.akroeCas{
   isatae fnto( {
    ntnit: ucin)
     rtr ti.rae)
      eun hscet(;
   }
};
 )
COMPUTED PROPERTIES
ApCnat=EbrOjc.xed{
 p.otc    me.betetn(
   frtae nl,
    isnm: ul
   lsnm:nl,
    atae ul
   eal nl,
    mi: ul

     flnm:fnto( {
      ulae ucin)
       rtr ti.e(frtae)+''+ti.e(lsnm'
        eun hsgt'isnm'     hsgt'atae)
;
     }poet(frtae,'atae)
      .rpry'isnm' lsnm'
};
 )
COMPUTED PROPERTIES
           GETTERS / SETTERS
ApCnatroe(
 p.otc.epn{
   flnm:fnto(e,vle {
    ulae ucinky au)
     / gte
      / etr
     i (ruet.egh==1 {
      f agmnslnt = )
        rtr ti.e(frtae)
        eun hsgt'isnm'
          +''+ti.e(lsnm';
                hsgt'atae)
     / ste
      / etr
     }es {
       le
        vrnm =vleslt"";
        a ae   au.pi( )
        ti.e(frtae,nm[];
        hsst'isNm' ae0)
        ti.e(lsNm' nm[];
        hsst'atae, ae1)
     }
   }poet(frtae,'atae)
    .rpry'isnm' lsnm'
};
 )
BINDINGS
ApCnat=EbrOjc.xed{
 p.otc    me.betetn(
   frtae nl,
    isnm: ul
   lsnm:nl,
    atae ul
   eal nl,
    mi: ul

     adesokidn:'p.esnldrsbo.ae
      drsboBnig ApProaAdesoknm'
};
 )

vrc=ApCnatcet(
 a    p.otc.rae{
   frtae 'on,
    isnm: Jh'
   lsnm:'o'
    atae De
};
 )
cnoelgcgt'drsbo') / - 'ycnat'
 osl.o(.e(adesok); / > M otcs
OBSERVERS
ApTd =EbrOjc.xed{
 p.oo   me.betetn(
   tte nl,
    il: ul
   cmltd fle
    opee: as,

     tdCagd fnto( {
      oohne: ucin)
       Apsoesv(hs;
        p.tr.aeti)
     }osre(tte,'opee'
      .bevs'il' cmltd)
};
 )
OBSERVERS
        SYNTAXES ALTERNATIVES
ApTd =EbrOjc.xed{
 p.oo    me.betetn(
   tte nl,
    il: ul
   cmltd fle
    opee: as,
   tdCagd Ebrosre(ucin){
    oohne: me.bevrfnto(
      Apsoesv(hs;
       p.tr.aeti)
   } 'il' 'opee'
    , tte, cmltd)
};
 )



vrtd =ApTd.rae)
 a oo   p.oocet(;
td.dOsre(tte,'opee' fnto( {
 ooadbevr'il' cmltd, ucin)
   Apsoesv(hs;
    p.tr.aeti)
};
 )
OBSERVERS SUR LES ARRAYS
ApTdLs =EbrOjc.xed{
 p.ooit   me.betetn(
   tds [,
    oo: ]

     cmltd fnto( {
      opee: ucin)
       rtr ti.e(tds)flePoet(cmltd,tu
        eun hsgt'oo'.itrrpry'opee' re
);
     }poet(tds@ahcmltd)
      .rpry'oo.ec.opee'
};
 )
ENUMERABLES
vrtds=[
 a oo
   ApTd.rae{tte 'cee l pi'},
    p.oocet( il: Ahtr e an )
   ApTd.rae{tte 'ii mssie'},
    p.oocet( il: Fnr e lds )
   ApTd.rae{tte 'oe d l giae }
    p.oocet( il: Jur e a utr' )
];

tdsfrahfnto(tm idx sl){
 oo.oEc(ucinie, ne, ef
   ie.e(cmltd,tu)
    tmst'opee' re;
};
 )

tdsivk(cmlt';
 oo.noe'opee)
ENUMERABLES #2
vrtte =tdsmpfnto(tm {
 a ils   oo.a(ucinie)
   rtr ie.e(tte)
    eun tmgt'il';
};
 )

vrtte =tdsmprpry'il';
 a ils  oo.aPoet(tte)



vrcmltd=tdsfle(ucinie){
 a opee   oo.itrfnto(tm
   rtr ie.e(cmltd)==tu;
    eun tmgt'opee' = re
};
 )

vrcmltd=tdsflePoet(cmltd,tu)
 a opee oo.itrrpry'opee' re;
ENUMERABLES #3
vralopee =tdseeyfnto(tm {
 a lCmltd   oo.vr(ucinie)
   rtr ie.e(cmltd)==tu;
    eun tmgt'opee' = re
};
 )

vralopee =tdseeyrpry'opee' tu)
 a lCmltd  oo.vrPoet(cmltd, re;



vrsmCmltd=tdssm(ucinie){
 a oeopee    oo.oefnto(tm
   rtr ie.e(cmltd)==tu;
    eun tmgt'opee' = re
};
 )

vrsmCmltd=tdssmPoet(cmltd,tu)
 a oeopee  oo.oerpry'opee' re;
HANDLEBARS
<pncas"il"{ts.il}<sa>
 sa ls=tte>{aktte}/pn
< he=# cas"sine>{akasge.ae}/>
 a rf"" ls=asge"{ts.sinenm}<a
{#fts.uA}
 {i akdet}
   Dea {fra_aets.uA}
    u t {omtdt akdet}
{/f}
 {i}
VIEWS ET TEMPLATES
<cittp=tx/-adeas dt-epaenm=h"
 srp ye"etxhnlbr" aatmlt-ae"i>
   H,{nm}
    i {ae}
<srp>
 /cit



vrve =EbrVe.rae{
 a iw   me.iwcet(
   tmltNm:'i,
    epaeae h'
   nm:'o'
    ae Bb
};
 )

ve.pedo'cnanr)
 iwapnT(#otie';
TEMPLATES ET BINDINGS
H,{nm}
 i {ae}



H,
 i
<citi=mtmrh0sat tp=tx/-lchle"<srp
 srp d"eaop--tr" ye"etxpaeodr>/cit
>
Bb
 o
<citi=mtmrh1sat tp=tx/-lchle"<srp
 srp d"eaop--tr" ye"etxpaeodr>/cit
>



H,{ubudnm}
 i {non ae}



H,Bb
 i o
HELPERS HANDLEBARS
            {{bindAttr}}
ApNtcVe =EbrVe.rae{
 p.oieiw    me.iwcet(
   seiiCSls:'brntc-i,
    pcfcSCas ue-oieu'
   iErr tu
    sro: re
};
 )



<i {bnAt cas"pcfcSCasiErr}>
 dv {idtr ls=seiiCSls sro"}
  Lrmism
  oe pu
<dv
 /i>

= <i cas"brntc-ii-ro"Lrmism/i>
 > dv ls=ue-oieu serr>oe pu<dv
HELPERS HANDLEBARS
            {{bindAttr}}
<i {bnAt cas"sro:ro:no}>
 dv {idtr ls=iErrerrif"}
  Lrmism
  oe pu
<dv
 /i>



<i {bnAt cas"sro:err}>
 dv {idtr ls=iErr:ro"}
  Lrmism
  oe pu
<dv
 /i>
HELPERS HANDLEBARS
                  {{view}}
ApCnatiw=EbrVe.xed{
p.otcVe      me.iwetn(
   tmltNm:'otc'
    epaeae cnat,
   cnat ApCnatcet(
    otc: p.otc.rae{
      frtae 'on,lsnm:'o'
       isnm: Jh' atae De,
      eal 'dez.o'
       mi: jo@zcm
   })
};
)

ApCnatnoiw=EbrVe.xed{
p.otcIfVe    me.iwetn(
   tmltNm:'no
   epaeae if'
};
)
<cittp=tx/-adeas dt-epaenm=cnat>
srp ye"etxhnlbr" aatmlt-ae"otc"
  Nm:{cnatfrtae}{cnatlsnm}
  ae {otc.isnm} {otc.atae}
  {ve ApCnatnoiwcnatidn=cnat}
  {iw p.otcIfVe otcBnig"otc"}
<srp>
/cit

<cittp=tx/-adeas dt-epaenm=if"
srp ye"etxhnlbr" aatmlt-ae"no>
  Eal {cnateal}
  mi: {otc.mi}
<srp>
/cit
HELPERS HANDLEBARS
             {{view}}
<cittp=tx/-adeas dt-epaenm=cnat>
 srp ye"etxhnlbr" aatmlt-ae"otc"
   Nm:{cnatfrtae}{cnatlsnm}
    ae {otc.isnm} {otc.atae}
   {#iwApCnatnoiwcnatidn=cnat}
    {ve p.otcIfVe otcBnig"otc"}
      Eal {cnateal}
       mi: {otc.mi}
   {/iw}
    {ve}
<srp>
 /cit
HELPERS HANDLEBARS
                   {{action}}
ApTdVe =EbrVe.xed{
p.ooiw   me.iwetn(
  tmltNm:'oove'
  epaeae td-iw,
  td:nl,
  oo ul
  iEiig fle
  sdtn: as,

     ei:fnto(vn){
      dt ucineet
        ti.e(iEiig,tu)
         hsst'sdtn' re;
     }
};
)




{ve EbrCeko cekdidn=td.opee"}
 {iw me.hcbx hceBnig"oocmltd}
{#fiEiig}
 {i sdtn}
   {ve EbrTxFedvleidn=td.il"}
   {iw me.etil auBnig"ootte}
{es}
 {le}
   <pn{ato "dt o=cik tre=prnVe"}{td.il}<sa
   sa {cin ei" n"lc" agt"aetiw}>{ootte}/p
n>
{/f}
 {i}
LE MVC DANS EMBER
CONTROLLERS
Aptdsotolr=EbrAryotolretn(
 p.ooCnrle    me.raCnrle.xed{
   rmiig fnto( {
    eann: ucin)
     rtr ti.itrrpry'opee' fle.e(lnt
      eun hsflePoet(cmltd, as)gt'eg
h)
 ';
   }poet(@ahcmltd)
    .rpry'ec.opee'
};
 )

$gt'oo.sn,fnto(aa {
 .e(tdsjo' ucindt)
   Aptdsotolrst'otn' dt)
    p.ooCnrle.e(cnet, aa;
};
 )



{#ahAptdsotolra td}
 {ec p.ooCnrle s oo}
   {ve ApTdVe tdBnig"oo}
    {iw p.ooiw ooidn=td"}
{/ah}
 {ec}
Rmiig {Aptdsotolrrmiig}
 eann: {p.ooCnrle.eann}
MODELS
               EMBER-DATA
ApTd =D.oe.xed{
p.oo    SMdletn(
   tte D.tr'tig)
   il: Sat(srn',
   cmltd D.tr'ola',
   opee: Sat(boen)
   onr D.eogT(ApUe'
   we: Sblnso'p.sr)
};
)

ApUe =D.oe.xed{
p.sr    SMdletn(
   flnm:D.tr'tig)
   ulae Sat(srn',
   tds D.aMn(ApTd'
   oo: Shsay'p.oo)
};
)

Apsoe=D.tr.rae{
p.tr    SSoecet(
   aatr D.ETdpe.rae)
   dpe: SRSAatrcet(
};
)
vrtds=ApsoefnAlApTd)
 a oo   p.tr.idl(p.oo;
/ - GT/oo
 / > E tds
ROUTER
wno.p =EbrApiaincet(
idwAp      me.plcto.rae{
   Apiainiw=EbrVe.xed{
    plctoVe     me.iwetn(
      tmltNm:'plcto'
       epaeae apiain
   },
    )
   Apiainotolr=EbrCnrle.xed{
    plctoCnrle     me.otolretn(
      tte 'ools'
       il: Td it
   },
    )
   Rue:EbrRue.xed{
    otr me.otretn(
      ro:EbrRueetn(
       ot me.ot.xed{
         idx EbrRueetn(
          ne: me.ot.xed{
            rue ''
            ot: /
         })
      })
   })
};
)




<cittp=tx/-adeas dt-epaenm=apiain>
srp ye"etxhnlbr" aatmlt-ae"plcto"
  <1{tte}/1
  h>{il}<h>
<srp>
/cit
ROUTER ET OUTLETS
wno.p =EbrApiaincet(
idwAp      me.plcto.rae{
   ..
    .
   soe=D.tr.rae)
    tr    SSoecet(,
   Rue:EbrRue.xed{
    otr me.otretn(
      ro:EbrRueetn(
       ot me.ot.xed{
         idx EbrRueetn(
          ne: me.ot.xed{
            rue ''
             ot: /,
            cnetult:fnto(otr cnet {
             oncOtes ucinrue, otx)
               rue.e(apiainotolr)cnetult'oo'
                otrgt'plctoCnrle'.oncOte(tds,
soefnAlApTd);
 tr.idl(p.oo)
            }
         })
      })
   })
};
)




<cittp=tx/-adeas dt-epaenm=apiain>
srp ye"etxhnlbr" aatmlt-ae"plcto"
  <1{tte}/1
  h>{il}<h>
  <i i=cnet>{ult}/i>
  dv d"otn"{ote}<dv
<srp>
/cit
ROUTER #2
wno.p =EbrApiaincet(
 idwAp     me.plcto.rae{
   ..
    .
   Rue:EbrRue.xed{
    otr me.otretn(
      ro:EbrRueetn(
       ot me.ot.xed{
         idx EbrRueetn(
          ne: me.ot.xed{
            rue ''
             ot: /,
            ..
             .
         },
          )
         cmltd EbrRueetn(
          opee: me.ot.xed{
            rue 'cmltd,
             ot: /opee'
            cnetult:fnto(otr cnet {
             oncOtes ucinrue, otx)
               rue.e(apiainotolr)cnetult'oo
                otrgt'plctoCnrle'.oncOte(tds
',
                  soefle(p.oo fnto(oo {
                   tr.itrApTd, ucintd)
                     rtr ie.e(cmltd)==tu;
                      eun tmgt'opee' = re
                  })
               );
            }
         })
      })
   })
};
 )
ROUTER ET TRANSITIONS
wno.p =EbrApiaincet(
idwAp      me.plcto.rae{
   ..
    .
   Rue:EbrRue.xed{
    otr me.otretn(
      ro:EbrRueetn(
       ot me.ot.xed{
         gtCmltd EbrRuetastoT(ro.opee',
          ooopee: me.ot.rniino'otcmltd)
         idx EbrRueetn(
          ne: me.ot.xed{
            rue ''
            ot: /,
            ..
            .
         },
          )
         cmltd EbrRueetn(
          opee: me.ot.xed{
            rue 'cmltd,
            ot: /opee'
            ..
            .
         })
      })
   })
};
)
<cittp=tx/-adeas dt-epaenm=apiain>
srp ye"etxhnlbr" aatmlt-ae"plcto"
  <1{tte}/1
   h>{il}<h>
  < {ato gtCmltd}Ve cmltd/>
   a {cin ooopee}>iw opee<a
  <i i=cnet>{ult}/i>
   dv d"otn"{ote}<dv
<srp>
/cit
CONCLUSION

Más contenido relacionado

La actualidad más candente

внимание, родители! о рисках, связанных с детской смертностью.
внимание, родители! о рисках, связанных с детской смертностью.внимание, родители! о рисках, связанных с детской смертностью.
внимание, родители! о рисках, связанных с детской смертностью.
virtualtaganrog
 

La actualidad más candente (19)

How to perform the Holy Hajj
How to perform the Holy HajjHow to perform the Holy Hajj
How to perform the Holy Hajj
 
arlingonfilescanin
arlingonfilescaninarlingonfilescanin
arlingonfilescanin
 
Low pass filter
Low pass filterLow pass filter
Low pass filter
 
Summary Java Programming ไทย
Summary Java  Programming ไทยSummary Java  Programming ไทย
Summary Java Programming ไทย
 
внимание, родители! о рисках, связанных с детской смертностью.
внимание, родители! о рисках, связанных с детской смертностью.внимание, родители! о рисках, связанных с детской смертностью.
внимание, родители! о рисках, связанных с детской смертностью.
 
How to performing salat accurately
How to performing salat accurately How to performing salat accurately
How to performing salat accurately
 
Visualizaciones gráficas con js
Visualizaciones gráficas con jsVisualizaciones gráficas con js
Visualizaciones gráficas con js
 
on line assignment approaches of social science
on line assignment approaches of social scienceon line assignment approaches of social science
on line assignment approaches of social science
 
Necessary Hindu Easy Mantra Bangla version
Necessary Hindu Easy Mantra Bangla version Necessary Hindu Easy Mantra Bangla version
Necessary Hindu Easy Mantra Bangla version
 
Cooperative societies act
Cooperative societies actCooperative societies act
Cooperative societies act
 
Mathematics 3 handwritten classes notes (study materials) for IES PSUs GATE
Mathematics 3 handwritten classes notes (study materials) for IES PSUs GATEMathematics 3 handwritten classes notes (study materials) for IES PSUs GATE
Mathematics 3 handwritten classes notes (study materials) for IES PSUs GATE
 
Radiotherapy in Carcinoma of the Urinary Bladder 1993
Radiotherapy in Carcinoma of the Urinary Bladder 1993Radiotherapy in Carcinoma of the Urinary Bladder 1993
Radiotherapy in Carcinoma of the Urinary Bladder 1993
 
Aluminium work order at momena manor
Aluminium work order at momena manorAluminium work order at momena manor
Aluminium work order at momena manor
 
RESPONSABILIDAD SOCIAL
RESPONSABILIDAD SOCIALRESPONSABILIDAD SOCIAL
RESPONSABILIDAD SOCIAL
 
Radiotherapy in Cancer Oesophagus 1993
Radiotherapy in Cancer Oesophagus 1993Radiotherapy in Cancer Oesophagus 1993
Radiotherapy in Cancer Oesophagus 1993
 
plozhenie_o_sovete
plozhenie_o_soveteplozhenie_o_sovete
plozhenie_o_sovete
 
Doc 20181110-wa0014
Doc 20181110-wa0014Doc 20181110-wa0014
Doc 20181110-wa0014
 
Ee made by mrp
Ee made by mrpEe made by mrp
Ee made by mrp
 
Fuciones matematicas
Fuciones matematicasFuciones matematicas
Fuciones matematicas
 

Más de goldoraf (6)

jQuery sans jQuery
jQuery sans jQueryjQuery sans jQuery
jQuery sans jQuery
 
Html5 : stockage local & synchronisation
Html5 : stockage local & synchronisationHtml5 : stockage local & synchronisation
Html5 : stockage local & synchronisation
 
Services web RESTful
Services web RESTfulServices web RESTful
Services web RESTful
 
Git ou le renouveau du contrôle de version
Git ou le renouveau du contrôle de versionGit ou le renouveau du contrôle de version
Git ou le renouveau du contrôle de version
 
Rich Desktop Applications
Rich Desktop ApplicationsRich Desktop Applications
Rich Desktop Applications
 
Forum PHP 2007 - Methodes Agiles
Forum PHP 2007 - Methodes AgilesForum PHP 2007 - Methodes Agiles
Forum PHP 2007 - Methodes Agiles
 

Ember.js

  • 2. MAIS QU'EST-CE ? ember.js est un framework MVC pour le développement de Single Page Apps, né des cendres de Sproutcore... Version stable : 0.9.8.1 Dernière version : 1.0.0-pre2
  • 4. MODÈLE OBJET ApTd =EbrOjc.xed{ p.oo me.betetn( tte nl, il: ul cmltd fle opee: as, cmlt:fnto( { opee ucin) ti.e(cmltd,tu) hsst'opee' re; } }; ) vrtd =ApTd.rae{ a oo p.oocet( tte 'cee d pi' il: Ahtr u an }; ) cnoelgtd.e(tte); osl.o(oogt'il') td.e(cmltd,tu) oost'opee' re;
  • 5. HÉRITAGE ApTs =ApTd.xed{ p.ak p.ooetn( det nl, uA: ul cmltdt nl, opeeA: ul cmlt:fnto( { opee ucin) ti.spr) hs_ue(; ti.e(cmltdt,nwDt() hsst'opeeA' e ae); } }; )
  • 6. RÉOUVERTURE D'INSTANCES ApTs.epn{ p.akroe( asge:nl sine ul }; ) RÉOUVERTURE DE "CLASSES" ApTs.epnls( p.akroeCas{ isatae fnto( { ntnit: ucin) rtr ti.rae) eun hscet(; } }; )
  • 7. COMPUTED PROPERTIES ApCnat=EbrOjc.xed{ p.otc me.betetn( frtae nl, isnm: ul lsnm:nl, atae ul eal nl, mi: ul flnm:fnto( { ulae ucin) rtr ti.e(frtae)+''+ti.e(lsnm' eun hsgt'isnm' hsgt'atae) ; }poet(frtae,'atae) .rpry'isnm' lsnm' }; )
  • 8. COMPUTED PROPERTIES GETTERS / SETTERS ApCnatroe( p.otc.epn{ flnm:fnto(e,vle { ulae ucinky au) / gte / etr i (ruet.egh==1 { f agmnslnt = ) rtr ti.e(frtae) eun hsgt'isnm' +''+ti.e(lsnm'; hsgt'atae) / ste / etr }es { le vrnm =vleslt""; a ae au.pi( ) ti.e(frtae,nm[]; hsst'isNm' ae0) ti.e(lsNm' nm[]; hsst'atae, ae1) } }poet(frtae,'atae) .rpry'isnm' lsnm' }; )
  • 9. BINDINGS ApCnat=EbrOjc.xed{ p.otc me.betetn( frtae nl, isnm: ul lsnm:nl, atae ul eal nl, mi: ul adesokidn:'p.esnldrsbo.ae drsboBnig ApProaAdesoknm' }; ) vrc=ApCnatcet( a p.otc.rae{ frtae 'on, isnm: Jh' lsnm:'o' atae De }; ) cnoelgcgt'drsbo') / - 'ycnat' osl.o(.e(adesok); / > M otcs
  • 10. OBSERVERS ApTd =EbrOjc.xed{ p.oo me.betetn( tte nl, il: ul cmltd fle opee: as, tdCagd fnto( { oohne: ucin) Apsoesv(hs; p.tr.aeti) }osre(tte,'opee' .bevs'il' cmltd) }; )
  • 11. OBSERVERS SYNTAXES ALTERNATIVES ApTd =EbrOjc.xed{ p.oo me.betetn( tte nl, il: ul cmltd fle opee: as, tdCagd Ebrosre(ucin){ oohne: me.bevrfnto( Apsoesv(hs; p.tr.aeti) } 'il' 'opee' , tte, cmltd) }; ) vrtd =ApTd.rae) a oo p.oocet(; td.dOsre(tte,'opee' fnto( { ooadbevr'il' cmltd, ucin) Apsoesv(hs; p.tr.aeti) }; )
  • 12. OBSERVERS SUR LES ARRAYS ApTdLs =EbrOjc.xed{ p.ooit me.betetn( tds [, oo: ] cmltd fnto( { opee: ucin) rtr ti.e(tds)flePoet(cmltd,tu eun hsgt'oo'.itrrpry'opee' re ); }poet(tds@ahcmltd) .rpry'oo.ec.opee' }; )
  • 13. ENUMERABLES vrtds=[ a oo ApTd.rae{tte 'cee l pi'}, p.oocet( il: Ahtr e an ) ApTd.rae{tte 'ii mssie'}, p.oocet( il: Fnr e lds ) ApTd.rae{tte 'oe d l giae } p.oocet( il: Jur e a utr' ) ]; tdsfrahfnto(tm idx sl){ oo.oEc(ucinie, ne, ef ie.e(cmltd,tu) tmst'opee' re; }; ) tdsivk(cmlt'; oo.noe'opee)
  • 14. ENUMERABLES #2 vrtte =tdsmpfnto(tm { a ils oo.a(ucinie) rtr ie.e(tte) eun tmgt'il'; }; ) vrtte =tdsmprpry'il'; a ils oo.aPoet(tte) vrcmltd=tdsfle(ucinie){ a opee oo.itrfnto(tm rtr ie.e(cmltd)==tu; eun tmgt'opee' = re }; ) vrcmltd=tdsflePoet(cmltd,tu) a opee oo.itrrpry'opee' re;
  • 15. ENUMERABLES #3 vralopee =tdseeyfnto(tm { a lCmltd oo.vr(ucinie) rtr ie.e(cmltd)==tu; eun tmgt'opee' = re }; ) vralopee =tdseeyrpry'opee' tu) a lCmltd oo.vrPoet(cmltd, re; vrsmCmltd=tdssm(ucinie){ a oeopee oo.oefnto(tm rtr ie.e(cmltd)==tu; eun tmgt'opee' = re }; ) vrsmCmltd=tdssmPoet(cmltd,tu) a oeopee oo.oerpry'opee' re;
  • 16. HANDLEBARS <pncas"il"{ts.il}<sa> sa ls=tte>{aktte}/pn < he=# cas"sine>{akasge.ae}/> a rf"" ls=asge"{ts.sinenm}<a {#fts.uA} {i akdet} Dea {fra_aets.uA} u t {omtdt akdet} {/f} {i}
  • 17. VIEWS ET TEMPLATES <cittp=tx/-adeas dt-epaenm=h" srp ye"etxhnlbr" aatmlt-ae"i> H,{nm} i {ae} <srp> /cit vrve =EbrVe.rae{ a iw me.iwcet( tmltNm:'i, epaeae h' nm:'o' ae Bb }; ) ve.pedo'cnanr) iwapnT(#otie';
  • 18. TEMPLATES ET BINDINGS H,{nm} i {ae} H, i <citi=mtmrh0sat tp=tx/-lchle"<srp srp d"eaop--tr" ye"etxpaeodr>/cit > Bb o <citi=mtmrh1sat tp=tx/-lchle"<srp srp d"eaop--tr" ye"etxpaeodr>/cit > H,{ubudnm} i {non ae} H,Bb i o
  • 19.
  • 20. HELPERS HANDLEBARS {{bindAttr}} ApNtcVe =EbrVe.rae{ p.oieiw me.iwcet( seiiCSls:'brntc-i, pcfcSCas ue-oieu' iErr tu sro: re }; ) <i {bnAt cas"pcfcSCasiErr}> dv {idtr ls=seiiCSls sro"} Lrmism oe pu <dv /i> = <i cas"brntc-ii-ro"Lrmism/i> > dv ls=ue-oieu serr>oe pu<dv
  • 21. HELPERS HANDLEBARS {{bindAttr}} <i {bnAt cas"sro:ro:no}> dv {idtr ls=iErrerrif"} Lrmism oe pu <dv /i> <i {bnAt cas"sro:err}> dv {idtr ls=iErr:ro"} Lrmism oe pu <dv /i>
  • 22. HELPERS HANDLEBARS {{view}} ApCnatiw=EbrVe.xed{ p.otcVe me.iwetn( tmltNm:'otc' epaeae cnat, cnat ApCnatcet( otc: p.otc.rae{ frtae 'on,lsnm:'o' isnm: Jh' atae De, eal 'dez.o' mi: jo@zcm }) }; ) ApCnatnoiw=EbrVe.xed{ p.otcIfVe me.iwetn( tmltNm:'no epaeae if' }; )
  • 23. <cittp=tx/-adeas dt-epaenm=cnat> srp ye"etxhnlbr" aatmlt-ae"otc" Nm:{cnatfrtae}{cnatlsnm} ae {otc.isnm} {otc.atae} {ve ApCnatnoiwcnatidn=cnat} {iw p.otcIfVe otcBnig"otc"} <srp> /cit <cittp=tx/-adeas dt-epaenm=if" srp ye"etxhnlbr" aatmlt-ae"no> Eal {cnateal} mi: {otc.mi} <srp> /cit
  • 24. HELPERS HANDLEBARS {{view}} <cittp=tx/-adeas dt-epaenm=cnat> srp ye"etxhnlbr" aatmlt-ae"otc" Nm:{cnatfrtae}{cnatlsnm} ae {otc.isnm} {otc.atae} {#iwApCnatnoiwcnatidn=cnat} {ve p.otcIfVe otcBnig"otc"} Eal {cnateal} mi: {otc.mi} {/iw} {ve} <srp> /cit
  • 25. HELPERS HANDLEBARS {{action}} ApTdVe =EbrVe.xed{ p.ooiw me.iwetn( tmltNm:'oove' epaeae td-iw, td:nl, oo ul iEiig fle sdtn: as, ei:fnto(vn){ dt ucineet ti.e(iEiig,tu) hsst'sdtn' re; } }; ) {ve EbrCeko cekdidn=td.opee"} {iw me.hcbx hceBnig"oocmltd} {#fiEiig} {i sdtn} {ve EbrTxFedvleidn=td.il"} {iw me.etil auBnig"ootte} {es} {le} <pn{ato "dt o=cik tre=prnVe"}{td.il}<sa sa {cin ei" n"lc" agt"aetiw}>{ootte}/p n> {/f} {i}
  • 26.
  • 27. LE MVC DANS EMBER
  • 28.
  • 29. CONTROLLERS Aptdsotolr=EbrAryotolretn( p.ooCnrle me.raCnrle.xed{ rmiig fnto( { eann: ucin) rtr ti.itrrpry'opee' fle.e(lnt eun hsflePoet(cmltd, as)gt'eg h) '; }poet(@ahcmltd) .rpry'ec.opee' }; ) $gt'oo.sn,fnto(aa { .e(tdsjo' ucindt) Aptdsotolrst'otn' dt) p.ooCnrle.e(cnet, aa; }; ) {#ahAptdsotolra td} {ec p.ooCnrle s oo} {ve ApTdVe tdBnig"oo} {iw p.ooiw ooidn=td"} {/ah} {ec} Rmiig {Aptdsotolrrmiig} eann: {p.ooCnrle.eann}
  • 30. MODELS EMBER-DATA ApTd =D.oe.xed{ p.oo SMdletn( tte D.tr'tig) il: Sat(srn', cmltd D.tr'ola', opee: Sat(boen) onr D.eogT(ApUe' we: Sblnso'p.sr) }; ) ApUe =D.oe.xed{ p.sr SMdletn( flnm:D.tr'tig) ulae Sat(srn', tds D.aMn(ApTd' oo: Shsay'p.oo) }; ) Apsoe=D.tr.rae{ p.tr SSoecet( aatr D.ETdpe.rae) dpe: SRSAatrcet( }; )
  • 31. vrtds=ApsoefnAlApTd) a oo p.tr.idl(p.oo; / - GT/oo / > E tds
  • 32. ROUTER wno.p =EbrApiaincet( idwAp me.plcto.rae{ Apiainiw=EbrVe.xed{ plctoVe me.iwetn( tmltNm:'plcto' epaeae apiain }, ) Apiainotolr=EbrCnrle.xed{ plctoCnrle me.otolretn( tte 'ools' il: Td it }, ) Rue:EbrRue.xed{ otr me.otretn( ro:EbrRueetn( ot me.ot.xed{ idx EbrRueetn( ne: me.ot.xed{ rue '' ot: / }) }) }) }; ) <cittp=tx/-adeas dt-epaenm=apiain> srp ye"etxhnlbr" aatmlt-ae"plcto" <1{tte}/1 h>{il}<h> <srp> /cit
  • 33. ROUTER ET OUTLETS wno.p =EbrApiaincet( idwAp me.plcto.rae{ .. . soe=D.tr.rae) tr SSoecet(, Rue:EbrRue.xed{ otr me.otretn( ro:EbrRueetn( ot me.ot.xed{ idx EbrRueetn( ne: me.ot.xed{ rue '' ot: /, cnetult:fnto(otr cnet { oncOtes ucinrue, otx) rue.e(apiainotolr)cnetult'oo' otrgt'plctoCnrle'.oncOte(tds, soefnAlApTd); tr.idl(p.oo) } }) }) }) }; ) <cittp=tx/-adeas dt-epaenm=apiain> srp ye"etxhnlbr" aatmlt-ae"plcto" <1{tte}/1 h>{il}<h> <i i=cnet>{ult}/i> dv d"otn"{ote}<dv <srp> /cit
  • 34.
  • 35. ROUTER #2 wno.p =EbrApiaincet( idwAp me.plcto.rae{ .. . Rue:EbrRue.xed{ otr me.otretn( ro:EbrRueetn( ot me.ot.xed{ idx EbrRueetn( ne: me.ot.xed{ rue '' ot: /, .. . }, ) cmltd EbrRueetn( opee: me.ot.xed{ rue 'cmltd, ot: /opee' cnetult:fnto(otr cnet { oncOtes ucinrue, otx) rue.e(apiainotolr)cnetult'oo otrgt'plctoCnrle'.oncOte(tds ', soefle(p.oo fnto(oo { tr.itrApTd, ucintd) rtr ie.e(cmltd)==tu; eun tmgt'opee' = re }) ); } }) }) }) }; )
  • 36. ROUTER ET TRANSITIONS wno.p =EbrApiaincet( idwAp me.plcto.rae{ .. . Rue:EbrRue.xed{ otr me.otretn( ro:EbrRueetn( ot me.ot.xed{ gtCmltd EbrRuetastoT(ro.opee', ooopee: me.ot.rniino'otcmltd) idx EbrRueetn( ne: me.ot.xed{ rue '' ot: /, .. . }, ) cmltd EbrRueetn( opee: me.ot.xed{ rue 'cmltd, ot: /opee' .. . }) }) }) }; )
  • 37. <cittp=tx/-adeas dt-epaenm=apiain> srp ye"etxhnlbr" aatmlt-ae"plcto" <1{tte}/1 h>{il}<h> < {ato gtCmltd}Ve cmltd/> a {cin ooopee}>iw opee<a <i i=cnet>{ult}/i> dv d"otn"{ote}<dv <srp> /cit