angularjs-rails 1.0.8 → 1.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/angularjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/angular-animate.js +677 -0
- data/vendor/assets/javascripts/angular-bootstrap-prettify.js +4 -14
- data/vendor/assets/javascripts/angular-bootstrap.js +1 -1
- data/vendor/assets/javascripts/angular-cookies.js +2 -14
- data/vendor/assets/javascripts/angular-loader.js +38 -4
- data/vendor/assets/javascripts/angular-mocks.js +225 -78
- data/vendor/assets/javascripts/angular-resource.js +181 -90
- data/vendor/assets/javascripts/angular-route.js +860 -0
- data/vendor/assets/javascripts/angular-sanitize.js +63 -61
- data/vendor/assets/javascripts/angular-scenario.js +21160 -18250
- data/vendor/assets/javascripts/angular-touch.js +536 -0
- data/vendor/assets/javascripts/angular.js +7827 -5083
- metadata +8 -292
- data/vendor/assets/javascripts/i18n/angular-locale_af-na.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_af-za.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_af.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_am-et.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_am.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-001.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-ae.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-bh.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-dz.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-eg.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-iq.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-jo.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-kw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-lb.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-ly.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-ma.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-om.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-qa.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-sa.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-sd.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-sy.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-tn.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar-ye.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ar.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_bg-bg.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_bg.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_bn-bd.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_bn-in.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_bn.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ca-ad.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ca-es.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ca.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_chr.js +0 -4
- data/vendor/assets/javascripts/i18n/angular-locale_cs-cz.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_cs.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_cy.js +0 -4
- data/vendor/assets/javascripts/i18n/angular-locale_da-dk.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_da.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_de-at.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_de-be.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_de-ch.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_de-de.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_de-li.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_de-lu.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_de.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_el-cy.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_el-gr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_el-polyton.js +0 -4
- data/vendor/assets/javascripts/i18n/angular-locale_el.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-as.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-au.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-bb.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-be.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-bm.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-bw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-bz.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-ca.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-dsrt-us.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-dsrt.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-fm.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-gb.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-gu.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-gy.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-hk.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-ie.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-in.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-iso.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-jm.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-mh.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-mp.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-mt.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-mu.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-na.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-nz.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-ph.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-pk.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-pr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-pw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-sg.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-tc.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-tt.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-um.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-us.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-vg.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-vi.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-za.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-zw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_en-zz.js +0 -4
- data/vendor/assets/javascripts/i18n/angular-locale_en.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-419.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-ar.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-bo.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-cl.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-co.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-cr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-do.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-ea.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-ec.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-es.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-gq.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-gt.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-hn.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-ic.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-mx.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-ni.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-pa.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-pe.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-pr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-py.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-sv.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-us.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-uy.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es-ve.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_es.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_et-ee.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_et.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_eu-es.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_eu.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fa-af.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fa-ir.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fa.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fi-fi.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fi.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fil-ph.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fil.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-be.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-bf.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-bi.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-bj.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-bl.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-ca.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-cd.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-cf.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-cg.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-ch.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-ci.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-cm.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-dj.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-fr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-ga.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-gf.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-gn.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-gp.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-gq.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-km.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-lu.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-mc.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-mf.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-mg.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-ml.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-mq.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-ne.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-re.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-rw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-sn.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-td.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-tg.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr-yt.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_fr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_gl-es.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_gl.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_gsw-ch.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_gsw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_gu-in.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_gu.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_haw.js +0 -4
- data/vendor/assets/javascripts/i18n/angular-locale_he-il.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_he.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_hi-in.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_hi.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_hr-hr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_hr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_hu-hu.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_hu.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_id-id.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_id.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_in.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_is-is.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_is.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_it-ch.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_it-it.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_it-sm.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_it.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_iw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ja-jp.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ja.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_kn-in.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_kn.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ko-kr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ko.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ln-cd.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ln-cg.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ln.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_lt-lt.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_lt.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_lv-lv.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_lv.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ml-in.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ml.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_mo.js +0 -4
- data/vendor/assets/javascripts/i18n/angular-locale_mr-in.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_mr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ms-bn.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ms-my.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ms.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_mt-mt.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_mt.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_nl-aw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_nl-be.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_nl-cw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_nl-nl.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_nl-sx.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_nl.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_no.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_or-in.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_or.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_pl-pl.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_pl.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_pt-ao.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_pt-br.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_pt-gw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_pt-mz.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_pt-pt.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_pt-st.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_pt.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ro-md.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ro-ro.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ro.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ru-md.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ru-ru.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ru-ua.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ru.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sk-sk.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sk.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sl-si.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sl.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sq-al.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sq.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sr-cyrl-ba.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sr-cyrl-me.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sr-cyrl-rs.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sr-cyrl.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sr-latn-ba.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sr-latn-me.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sr-latn-rs.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sr-latn.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sr-rs.js +0 -4
- data/vendor/assets/javascripts/i18n/angular-locale_sr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sv-fi.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sv-se.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sv.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sw-ke.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sw-tz.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_sw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ta-in.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ta-lk.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ta.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_te-in.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_te.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_th-th.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_th.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_tl-ph.js +0 -4
- data/vendor/assets/javascripts/i18n/angular-locale_tl.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_tr-tr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_tr.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_uk-ua.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_uk.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ur-in.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ur-pk.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_ur.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_vi-vn.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_vi.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh-cn.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh-hans-cn.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh-hans-hk.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh-hans-mo.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh-hans-sg.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh-hans.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh-hant-hk.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh-hant-mo.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh-hant-tw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh-hant.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh-hk.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh-tw.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zh.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zu-za.js +0 -98
- data/vendor/assets/javascripts/i18n/angular-locale_zu.js +0 -98
@@ -1,10 +1,11 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.
|
2
|
+
* @license AngularJS v1.2.0rc1
|
3
3
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
6
|
-
(function(window, angular, undefined) {
|
7
|
-
|
6
|
+
(function(window, angular, undefined) {'use strict';
|
7
|
+
|
8
|
+
var $resourceMinErr = angular.$$minErr('$resource');
|
8
9
|
|
9
10
|
/**
|
10
11
|
* @ngdoc overview
|
@@ -25,7 +26,7 @@
|
|
25
26
|
* the need to interact with the low level {@link ng.$http $http} service.
|
26
27
|
*
|
27
28
|
* # Installation
|
28
|
-
* To use $resource make sure you have included the `angular-resource.js` that comes in Angular
|
29
|
+
* To use $resource make sure you have included the `angular-resource.js` that comes in Angular
|
29
30
|
* package. You can also find this file on Google CDN, bower as well as at
|
30
31
|
* {@link http://code.angularjs.org/ code.angularjs.org}.
|
31
32
|
*
|
@@ -35,13 +36,20 @@
|
|
35
36
|
*
|
36
37
|
* and you are ready to get started!
|
37
38
|
*
|
38
|
-
* @param {string} url A
|
39
|
-
* `/user/:username`. If you are using a URL with a port number (e.g.
|
40
|
-
* `http://example.com:8080/api`),
|
41
|
-
*
|
39
|
+
* @param {string} url A parametrized URL template with parameters prefixed by `:` as in
|
40
|
+
* `/user/:username`. If you are using a URL with a port number (e.g.
|
41
|
+
* `http://example.com:8080/api`), it will be respected.
|
42
|
+
*
|
43
|
+
* If you are using a url with a suffix, just add the suffix, like this:
|
44
|
+
* `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')
|
45
|
+
* or even `$resource('http://example.com/resource/:resource_id.:format')`
|
46
|
+
* If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be
|
47
|
+
* collapsed down to a single `.`. If you need this sequence to appear and not collapse then you
|
48
|
+
* can escape it with `/\.`.
|
42
49
|
*
|
43
50
|
* @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
|
44
|
-
* `actions` methods.
|
51
|
+
* `actions` methods. If any of the parameter value is a function, it will be executed every time
|
52
|
+
* when a param value needs to be obtained for a request (unless the param was overridden).
|
45
53
|
*
|
46
54
|
* Each key value in the parameter object is first bound to url template if present and then any
|
47
55
|
* excess keys are appended to the url search query after the `?`.
|
@@ -53,21 +61,46 @@
|
|
53
61
|
* the data object (useful for non-GET operations).
|
54
62
|
*
|
55
63
|
* @param {Object.<Object>=} actions Hash with declaration of custom action that should extend the
|
56
|
-
* default set of resource actions. The declaration should be created in the
|
64
|
+
* default set of resource actions. The declaration should be created in the format of {@link
|
65
|
+
* ng.$http#Parameters $http.config}:
|
57
66
|
*
|
58
|
-
* {action1: {method:?, params:?, isArray
|
59
|
-
* action2: {method:?, params:?, isArray
|
67
|
+
* {action1: {method:?, params:?, isArray:?, headers:?, ...},
|
68
|
+
* action2: {method:?, params:?, isArray:?, headers:?, ...},
|
60
69
|
* ...}
|
61
70
|
*
|
62
71
|
* Where:
|
63
72
|
*
|
64
|
-
* -
|
73
|
+
* - **`action`** – {string} – The name of action. This name becomes the name of the method on your
|
65
74
|
* resource object.
|
66
|
-
* -
|
67
|
-
* and `JSONP
|
68
|
-
* -
|
69
|
-
*
|
75
|
+
* - **`method`** – {string} – HTTP request method. Valid methods are: `GET`, `POST`, `PUT`, `DELETE`,
|
76
|
+
* and `JSONP`.
|
77
|
+
* - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of the
|
78
|
+
* parameter value is a function, it will be executed every time when a param value needs to be
|
79
|
+
* obtained for a request (unless the param was overridden).
|
80
|
+
* - **`url`** – {string} – action specific `url` override. The url templating is supported just like
|
81
|
+
* for the resource-level urls.
|
82
|
+
* - **`isArray`** – {boolean=} – If true then the returned object for this action is an array, see
|
70
83
|
* `returns` section.
|
84
|
+
* - **`transformRequest`** – `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
|
85
|
+
* transform function or an array of such functions. The transform function takes the http
|
86
|
+
* request body and headers and returns its transformed (typically serialized) version.
|
87
|
+
* - **`transformResponse`** – `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
|
88
|
+
* transform function or an array of such functions. The transform function takes the http
|
89
|
+
* response body and headers and returns its transformed (typically deserialized) version.
|
90
|
+
* - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
|
91
|
+
* GET request, otherwise if a cache instance built with
|
92
|
+
* {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
|
93
|
+
* caching.
|
94
|
+
* - **`timeout`** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} that
|
95
|
+
* should abort the request when resolved.
|
96
|
+
* - **`withCredentials`** - `{boolean}` - whether to to set the `withCredentials` flag on the
|
97
|
+
* XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5
|
98
|
+
* requests with credentials} for more information.
|
99
|
+
* - **`responseType`** - `{string}` - see {@link
|
100
|
+
* https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType requestType}.
|
101
|
+
* - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
|
102
|
+
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
|
103
|
+
* with `http response` object. See {@link ng.$http $http interceptors}.
|
71
104
|
*
|
72
105
|
* @returns {Object} A resource "class" object with methods for the default set of resource actions
|
73
106
|
* optionally extended with custom `actions`. The default set contains these actions:
|
@@ -106,6 +139,27 @@
|
|
106
139
|
* - non-GET "class" actions: `Resource.action([parameters], postData, [success], [error])`
|
107
140
|
* - non-GET instance actions: `instance.$action([parameters], [success], [error])`
|
108
141
|
*
|
142
|
+
* Success callback is called with (value, responseHeaders) arguments. Error callback is called
|
143
|
+
* with (httpResponse) argument.
|
144
|
+
*
|
145
|
+
* Class actions return empty instance (with additional properties below).
|
146
|
+
* Instance actions return promise of the action.
|
147
|
+
*
|
148
|
+
* The Resource instances and collection have these additional properties:
|
149
|
+
*
|
150
|
+
* - `$promise`: the {@link ng.$q promise} of the original server interaction that created this
|
151
|
+
* instance or collection.
|
152
|
+
*
|
153
|
+
* On success, the promise is resolved with the same resource instance or collection object,
|
154
|
+
* updated with data from server. This makes it easy to use in
|
155
|
+
* {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view rendering
|
156
|
+
* until the resource(s) are loaded.
|
157
|
+
*
|
158
|
+
* On failure, the promise is resolved with the {@link ng.$http http response} object,
|
159
|
+
* without the `resource` property.
|
160
|
+
*
|
161
|
+
* - `$resolved`: `true` after first server interaction is completed (either with success or rejection),
|
162
|
+
* `false` before that. Knowing if the Resource has been resolved is useful in data-binding.
|
109
163
|
*
|
110
164
|
* @example
|
111
165
|
*
|
@@ -149,7 +203,7 @@
|
|
149
203
|
* The object returned from this function execution is a resource "class" which has "static" method
|
150
204
|
* for each action in the definition.
|
151
205
|
*
|
152
|
-
* Calling these methods invoke `$http` on the `url` template with the given `method` and `
|
206
|
+
* Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and `headers`.
|
153
207
|
* When the data is returned from the server then the object is an instance of the resource type and
|
154
208
|
* all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
|
155
209
|
* operations (create, read, update, delete) on server-side data.
|
@@ -226,7 +280,7 @@
|
|
226
280
|
</doc:example>
|
227
281
|
*/
|
228
282
|
angular.module('ngResource', ['ng']).
|
229
|
-
factory('$resource', ['$http', '$parse', function($http, $parse) {
|
283
|
+
factory('$resource', ['$http', '$parse', '$q', function($http, $parse, $q) {
|
230
284
|
var DEFAULT_ACTIONS = {
|
231
285
|
'get': {method:'GET'},
|
232
286
|
'save': {method:'POST'},
|
@@ -264,7 +318,7 @@ angular.module('ngResource', ['ng']).
|
|
264
318
|
|
265
319
|
/**
|
266
320
|
* This method is intended for encoding *key* or *value* parts of query component. We need a custom
|
267
|
-
* method
|
321
|
+
* method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be
|
268
322
|
* encoded per http://tools.ietf.org/html/rfc3986:
|
269
323
|
* query = *( pchar / "/" / "?" )
|
270
324
|
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
@@ -283,32 +337,34 @@ angular.module('ngResource', ['ng']).
|
|
283
337
|
}
|
284
338
|
|
285
339
|
function Route(template, defaults) {
|
286
|
-
this.template = template
|
340
|
+
this.template = template;
|
287
341
|
this.defaults = defaults || {};
|
288
|
-
|
289
|
-
forEach(template.split(/\W/), function(param){
|
290
|
-
if (param && (new RegExp("(^|[^\\\\]):" + param + "\\W").test(template))) {
|
291
|
-
urlParams[param] = true;
|
292
|
-
}
|
293
|
-
});
|
294
|
-
this.template = template.replace(/\\:/g, ':');
|
342
|
+
this.urlParams = {};
|
295
343
|
}
|
296
344
|
|
297
345
|
Route.prototype = {
|
298
|
-
|
346
|
+
setUrlParams: function(config, params, actionUrl) {
|
299
347
|
var self = this,
|
300
|
-
url =
|
348
|
+
url = actionUrl || self.template,
|
301
349
|
val,
|
302
350
|
encodedVal;
|
303
351
|
|
352
|
+
var urlParams = self.urlParams = {};
|
353
|
+
forEach(url.split(/\W/), function(param){
|
354
|
+
if (!(new RegExp("^\\d+$").test(param)) && param && (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
|
355
|
+
urlParams[param] = true;
|
356
|
+
}
|
357
|
+
});
|
358
|
+
url = url.replace(/\\:/g, ':');
|
359
|
+
|
304
360
|
params = params || {};
|
305
|
-
forEach(
|
361
|
+
forEach(self.urlParams, function(_, urlParam){
|
306
362
|
val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
|
307
363
|
if (angular.isDefined(val) && val !== null) {
|
308
364
|
encodedVal = encodeUriSegment(val);
|
309
|
-
url = url.replace(new RegExp(":" + urlParam + "(\\W)", "g"), encodedVal + "$1");
|
365
|
+
url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), encodedVal + "$1");
|
310
366
|
} else {
|
311
|
-
url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W)", "g"), function(match,
|
367
|
+
url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match,
|
312
368
|
leadingSlashes, tail) {
|
313
369
|
if (tail.charAt(0) == '/') {
|
314
370
|
return tail;
|
@@ -318,16 +374,23 @@ angular.module('ngResource', ['ng']).
|
|
318
374
|
});
|
319
375
|
}
|
320
376
|
});
|
321
|
-
|
322
|
-
|
377
|
+
|
378
|
+
// strip trailing slashes and set the url
|
379
|
+
url = url.replace(/\/+$/, '');
|
380
|
+
// then replace collapse `/.` if found in the last URL path segment before the query
|
381
|
+
// E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x`
|
382
|
+
url = url.replace(/\/\.(?=\w+($|\?))/, '.');
|
383
|
+
// replace escaped `/\.` with `/.`
|
384
|
+
config.url = url.replace(/\/\\\./, '/.');
|
385
|
+
|
386
|
+
|
387
|
+
// set params - delegate param encoding to $http
|
323
388
|
forEach(params, function(value, key){
|
324
389
|
if (!self.urlParams[key]) {
|
325
|
-
|
390
|
+
config.params = config.params || {};
|
391
|
+
config.params[key] = value;
|
326
392
|
}
|
327
393
|
});
|
328
|
-
query.sort();
|
329
|
-
url = url.replace(/\/*$/, '');
|
330
|
-
return url + (query.length ? '?' + query.join('&') : '');
|
331
394
|
}
|
332
395
|
};
|
333
396
|
|
@@ -341,23 +404,26 @@ angular.module('ngResource', ['ng']).
|
|
341
404
|
var ids = {};
|
342
405
|
actionParams = extend({}, paramDefaults, actionParams);
|
343
406
|
forEach(actionParams, function(value, key){
|
344
|
-
|
407
|
+
if (isFunction(value)) { value = value(); }
|
408
|
+
ids[key] = value && value.charAt && value.charAt(0) == '@' ? getter(data, value.substr(1)) : value;
|
345
409
|
});
|
346
410
|
return ids;
|
347
411
|
}
|
348
412
|
|
413
|
+
function defaultResponseInterceptor(response) {
|
414
|
+
return response.resource;
|
415
|
+
}
|
416
|
+
|
349
417
|
function Resource(value){
|
350
418
|
copy(value || {}, this);
|
351
419
|
}
|
352
420
|
|
353
421
|
forEach(actions, function(action, name) {
|
354
|
-
|
355
|
-
|
422
|
+
var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method);
|
423
|
+
|
356
424
|
Resource[name] = function(a1, a2, a3, a4) {
|
357
|
-
var params = {};
|
358
|
-
|
359
|
-
var success = noop;
|
360
|
-
var error = null;
|
425
|
+
var params = {}, data, success, error;
|
426
|
+
|
361
427
|
switch(arguments.length) {
|
362
428
|
case 4:
|
363
429
|
error = a4;
|
@@ -388,58 +454,83 @@ angular.module('ngResource', ['ng']).
|
|
388
454
|
break;
|
389
455
|
case 0: break;
|
390
456
|
default:
|
391
|
-
throw
|
392
|
-
arguments
|
457
|
+
throw $resourceMinErr('badargs',
|
458
|
+
"Expected up to 4 arguments [params, data, success, error], got {0} arguments", arguments.length);
|
393
459
|
}
|
394
460
|
|
395
|
-
var
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
}).then(function(response) {
|
401
|
-
var data = response.data;
|
402
|
-
|
403
|
-
if (data) {
|
404
|
-
if (action.isArray) {
|
405
|
-
value.length = 0;
|
406
|
-
forEach(data, function(item) {
|
407
|
-
value.push(new Resource(item));
|
408
|
-
});
|
409
|
-
} else {
|
410
|
-
copy(data, value);
|
411
|
-
}
|
412
|
-
}
|
413
|
-
(success||noop)(value, response.headers);
|
414
|
-
}, error);
|
461
|
+
var isInstanceCall = data instanceof Resource;
|
462
|
+
var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
|
463
|
+
var httpConfig = {};
|
464
|
+
var responseInterceptor = action.interceptor && action.interceptor.response || defaultResponseInterceptor;
|
465
|
+
var responseErrorInterceptor = action.interceptor && action.interceptor.responseError || undefined;
|
415
466
|
|
416
|
-
|
417
|
-
|
467
|
+
forEach(action, function(value, key) {
|
468
|
+
if (key != 'params' && key != 'isArray' && key != 'interceptor') {
|
469
|
+
httpConfig[key] = copy(value);
|
470
|
+
}
|
471
|
+
});
|
418
472
|
|
473
|
+
httpConfig.data = data;
|
474
|
+
route.setUrlParams(httpConfig, extend({}, extractParams(data, action.params || {}), params), action.url);
|
419
475
|
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
error;
|
476
|
+
var promise = $http(httpConfig).then(function(response) {
|
477
|
+
var data = response.data,
|
478
|
+
promise = value.$promise;
|
424
479
|
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
480
|
+
if (data) {
|
481
|
+
if ( angular.isArray(data) != !!action.isArray ) {
|
482
|
+
throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected response' +
|
483
|
+
' to contain an {0} but got an {1}',
|
484
|
+
action.isArray?'array':'object', angular.isArray(data)?'array':'object');
|
485
|
+
}
|
486
|
+
if (action.isArray) {
|
487
|
+
value.length = 0;
|
488
|
+
forEach(data, function(item) {
|
489
|
+
value.push(new Resource(item));
|
490
|
+
});
|
491
|
+
} else {
|
492
|
+
copy(data, value);
|
493
|
+
value.$promise = promise;
|
494
|
+
}
|
435
495
|
}
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
496
|
+
|
497
|
+
value.$resolved = true;
|
498
|
+
|
499
|
+
(success||noop)(value, response.headers);
|
500
|
+
|
501
|
+
response.resource = value;
|
502
|
+
|
503
|
+
return response;
|
504
|
+
}, function(response) {
|
505
|
+
value.$resolved = true;
|
506
|
+
|
507
|
+
(error||noop)(response);
|
508
|
+
|
509
|
+
return $q.reject(response);
|
510
|
+
}).then(responseInterceptor, responseErrorInterceptor);
|
511
|
+
|
512
|
+
|
513
|
+
if (!isInstanceCall) {
|
514
|
+
// we are creating instance / collection
|
515
|
+
// - set the initial promise
|
516
|
+
// - return the instance / collection
|
517
|
+
value.$promise = promise;
|
518
|
+
value.$resolved = false;
|
519
|
+
|
520
|
+
return value;
|
521
|
+
}
|
522
|
+
|
523
|
+
// instance call
|
524
|
+
return promise;
|
525
|
+
};
|
526
|
+
|
527
|
+
|
528
|
+
Resource.prototype['$' + name] = function(params, success, error) {
|
529
|
+
if (isFunction(params)) {
|
530
|
+
error = success; success = params; params = {};
|
440
531
|
}
|
441
|
-
var
|
442
|
-
|
532
|
+
var result = Resource[name](params, this, success, error);
|
533
|
+
return result.$promise || result;
|
443
534
|
};
|
444
535
|
});
|
445
536
|
|
@@ -0,0 +1,860 @@
|
|
1
|
+
/**
|
2
|
+
* @license AngularJS v1.2.0rc1
|
3
|
+
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
4
|
+
* License: MIT
|
5
|
+
*/
|
6
|
+
(function(window, angular, undefined) {'use strict';
|
7
|
+
|
8
|
+
var copy = angular.copy,
|
9
|
+
equals = angular.equals,
|
10
|
+
extend = angular.extend,
|
11
|
+
forEach = angular.forEach,
|
12
|
+
isDefined = angular.isDefined,
|
13
|
+
isFunction = angular.isFunction,
|
14
|
+
isString = angular.isString,
|
15
|
+
jqLite = angular.element,
|
16
|
+
noop = angular.noop,
|
17
|
+
toJson = angular.toJson;
|
18
|
+
|
19
|
+
|
20
|
+
function inherit(parent, extra) {
|
21
|
+
return extend(new (extend(function() {}, {prototype:parent}))(), extra);
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* @ngdoc overview
|
26
|
+
* @name ngRoute
|
27
|
+
* @description
|
28
|
+
*
|
29
|
+
* Module that provides routing and deeplinking services and directives for angular apps.
|
30
|
+
*/
|
31
|
+
|
32
|
+
var ngRouteModule = angular.module('ngRoute', ['ng']).
|
33
|
+
provider('$route', $RouteProvider);
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @ngdoc object
|
37
|
+
* @name ngRoute.$routeProvider
|
38
|
+
* @function
|
39
|
+
*
|
40
|
+
* @description
|
41
|
+
*
|
42
|
+
* Used for configuring routes. See {@link ngRoute.$route $route} for an example.
|
43
|
+
*/
|
44
|
+
function $RouteProvider(){
|
45
|
+
var routes = {};
|
46
|
+
|
47
|
+
/**
|
48
|
+
* @ngdoc method
|
49
|
+
* @name ngRoute.$routeProvider#when
|
50
|
+
* @methodOf ngRoute.$routeProvider
|
51
|
+
*
|
52
|
+
* @param {string} path Route path (matched against `$location.path`). If `$location.path`
|
53
|
+
* contains redundant trailing slash or is missing one, the route will still match and the
|
54
|
+
* `$location.path` will be updated to add or drop the trailing slash to exactly match the
|
55
|
+
* route definition.
|
56
|
+
*
|
57
|
+
* * `path` can contain named groups starting with a colon (`:name`). All characters up
|
58
|
+
* to the next slash are matched and stored in `$routeParams` under the given `name`
|
59
|
+
* when the route matches.
|
60
|
+
* * `path` can contain named groups starting with a colon and ending with a star (`:name*`).
|
61
|
+
* All characters are eagerly stored in `$routeParams` under the given `name`
|
62
|
+
* when the route matches.
|
63
|
+
* * `path` can contain optional named groups with a question mark (`:name?`).
|
64
|
+
*
|
65
|
+
* For example, routes like `/color/:color/largecode/:largecode*\/edit` will match
|
66
|
+
* `/color/brown/largecode/code/with/slashs/edit` and extract:
|
67
|
+
*
|
68
|
+
* * `color: brown`
|
69
|
+
* * `largecode: code/with/slashs`.
|
70
|
+
*
|
71
|
+
*
|
72
|
+
* @param {Object} route Mapping information to be assigned to `$route.current` on route
|
73
|
+
* match.
|
74
|
+
*
|
75
|
+
* Object properties:
|
76
|
+
*
|
77
|
+
* - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly
|
78
|
+
* created scope or the name of a {@link angular.Module#controller registered controller}
|
79
|
+
* if passed as a string.
|
80
|
+
* - `controllerAs` – `{string=}` – A controller alias name. If present the controller will be
|
81
|
+
* published to scope under the `controllerAs` name.
|
82
|
+
* - `template` – `{string=|function()=}` – html template as a string or a function that
|
83
|
+
* returns an html template as a string which should be used by {@link
|
84
|
+
* ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives.
|
85
|
+
* This property takes precedence over `templateUrl`.
|
86
|
+
*
|
87
|
+
* If `template` is a function, it will be called with the following parameters:
|
88
|
+
*
|
89
|
+
* - `{Array.<Object>}` - route parameters extracted from the current
|
90
|
+
* `$location.path()` by applying the current route
|
91
|
+
*
|
92
|
+
* - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
|
93
|
+
* template that should be used by {@link ngRoute.directive:ngView ngView}.
|
94
|
+
*
|
95
|
+
* If `templateUrl` is a function, it will be called with the following parameters:
|
96
|
+
*
|
97
|
+
* - `{Array.<Object>}` - route parameters extracted from the current
|
98
|
+
* `$location.path()` by applying the current route
|
99
|
+
*
|
100
|
+
* - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
|
101
|
+
* be injected into the controller. If any of these dependencies are promises, they will be
|
102
|
+
* resolved and converted to a value before the controller is instantiated and the
|
103
|
+
* `$routeChangeSuccess` event is fired. The map object is:
|
104
|
+
*
|
105
|
+
* - `key` – `{string}`: a name of a dependency to be injected into the controller.
|
106
|
+
* - `factory` - `{string|function}`: If `string` then it is an alias for a service.
|
107
|
+
* Otherwise if function, then it is {@link api/AUTO.$injector#invoke injected}
|
108
|
+
* and the return value is treated as the dependency. If the result is a promise, it is resolved
|
109
|
+
* before its value is injected into the controller. Be aware that `ngRoute.$routeParams` will
|
110
|
+
* still refer to the previous route within these resolve functions. Use `$route.current.params`
|
111
|
+
* to access the new route parameters, instead.
|
112
|
+
*
|
113
|
+
* - `redirectTo` – {(string|function())=} – value to update
|
114
|
+
* {@link ng.$location $location} path with and trigger route redirection.
|
115
|
+
*
|
116
|
+
* If `redirectTo` is a function, it will be called with the following parameters:
|
117
|
+
*
|
118
|
+
* - `{Object.<string>}` - route parameters extracted from the current
|
119
|
+
* `$location.path()` by applying the current route templateUrl.
|
120
|
+
* - `{string}` - current `$location.path()`
|
121
|
+
* - `{Object}` - current `$location.search()`
|
122
|
+
*
|
123
|
+
* The custom `redirectTo` function is expected to return a string which will be used
|
124
|
+
* to update `$location.path()` and `$location.search()`.
|
125
|
+
*
|
126
|
+
* - `[reloadOnSearch=true]` - {boolean=} - reload route when only $location.search()
|
127
|
+
* changes.
|
128
|
+
*
|
129
|
+
* If the option is set to `false` and url in the browser changes, then
|
130
|
+
* `$routeUpdate` event is broadcasted on the root scope.
|
131
|
+
*
|
132
|
+
* - `[caseInsensitiveMatch=false]` - {boolean=} - match routes without being case sensitive
|
133
|
+
*
|
134
|
+
* If the option is set to `true`, then the particular route can be matched without being
|
135
|
+
* case sensitive
|
136
|
+
*
|
137
|
+
* @returns {Object} self
|
138
|
+
*
|
139
|
+
* @description
|
140
|
+
* Adds a new route definition to the `$route` service.
|
141
|
+
*/
|
142
|
+
this.when = function(path, route) {
|
143
|
+
routes[path] = extend(
|
144
|
+
{reloadOnSearch: true},
|
145
|
+
route,
|
146
|
+
path && pathRegExp(path, route)
|
147
|
+
);
|
148
|
+
|
149
|
+
// create redirection for trailing slashes
|
150
|
+
if (path) {
|
151
|
+
var redirectPath = (path[path.length-1] == '/')
|
152
|
+
? path.substr(0, path.length-1)
|
153
|
+
: path +'/';
|
154
|
+
|
155
|
+
routes[redirectPath] = extend(
|
156
|
+
{redirectTo: path},
|
157
|
+
pathRegExp(redirectPath, route)
|
158
|
+
);
|
159
|
+
}
|
160
|
+
|
161
|
+
return this;
|
162
|
+
};
|
163
|
+
|
164
|
+
/**
|
165
|
+
* @param path {string} path
|
166
|
+
* @param opts {Object} options
|
167
|
+
* @return {?Object}
|
168
|
+
*
|
169
|
+
* @description
|
170
|
+
* Normalizes the given path, returning a regular expression
|
171
|
+
* and the original path.
|
172
|
+
*
|
173
|
+
* Inspired by pathRexp in visionmedia/express/lib/utils.js.
|
174
|
+
*/
|
175
|
+
function pathRegExp(path, opts) {
|
176
|
+
var insensitive = opts.caseInsensitiveMatch,
|
177
|
+
ret = {
|
178
|
+
originalPath: path,
|
179
|
+
regexp: path
|
180
|
+
},
|
181
|
+
keys = ret.keys = [];
|
182
|
+
|
183
|
+
path = path
|
184
|
+
.replace(/([().])/g, '\\$1')
|
185
|
+
.replace(/(\/)?:(\w+)([\?|\*])?/g, function(_, slash, key, option){
|
186
|
+
var optional = option === '?' ? option : null;
|
187
|
+
var star = option === '*' ? option : null;
|
188
|
+
keys.push({ name: key, optional: !!optional });
|
189
|
+
slash = slash || '';
|
190
|
+
return ''
|
191
|
+
+ (optional ? '' : slash)
|
192
|
+
+ '(?:'
|
193
|
+
+ (optional ? slash : '')
|
194
|
+
+ (star && '(.+)?' || '([^/]+)?') + ')'
|
195
|
+
+ (optional || '');
|
196
|
+
})
|
197
|
+
.replace(/([\/$\*])/g, '\\$1');
|
198
|
+
|
199
|
+
ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : '');
|
200
|
+
return ret;
|
201
|
+
}
|
202
|
+
|
203
|
+
/**
|
204
|
+
* @ngdoc method
|
205
|
+
* @name ngRoute.$routeProvider#otherwise
|
206
|
+
* @methodOf ngRoute.$routeProvider
|
207
|
+
*
|
208
|
+
* @description
|
209
|
+
* Sets route definition that will be used on route change when no other route definition
|
210
|
+
* is matched.
|
211
|
+
*
|
212
|
+
* @param {Object} params Mapping information to be assigned to `$route.current`.
|
213
|
+
* @returns {Object} self
|
214
|
+
*/
|
215
|
+
this.otherwise = function(params) {
|
216
|
+
this.when(null, params);
|
217
|
+
return this;
|
218
|
+
};
|
219
|
+
|
220
|
+
|
221
|
+
this.$get = ['$rootScope', '$location', '$routeParams', '$q', '$injector', '$http', '$templateCache', '$sce',
|
222
|
+
function( $rootScope, $location, $routeParams, $q, $injector, $http, $templateCache, $sce) {
|
223
|
+
|
224
|
+
/**
|
225
|
+
* @ngdoc object
|
226
|
+
* @name ngRoute.$route
|
227
|
+
* @requires $location
|
228
|
+
* @requires $routeParams
|
229
|
+
*
|
230
|
+
* @property {Object} current Reference to the current route definition.
|
231
|
+
* The route definition contains:
|
232
|
+
*
|
233
|
+
* - `controller`: The controller constructor as define in route definition.
|
234
|
+
* - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for
|
235
|
+
* controller instantiation. The `locals` contain
|
236
|
+
* the resolved values of the `resolve` map. Additionally the `locals` also contain:
|
237
|
+
*
|
238
|
+
* - `$scope` - The current route scope.
|
239
|
+
* - `$template` - The current route template HTML.
|
240
|
+
*
|
241
|
+
* @property {Array.<Object>} routes Array of all configured routes.
|
242
|
+
*
|
243
|
+
* @description
|
244
|
+
* Is used for deep-linking URLs to controllers and views (HTML partials).
|
245
|
+
* It watches `$location.url()` and tries to map the path to an existing route definition.
|
246
|
+
*
|
247
|
+
* You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API.
|
248
|
+
*
|
249
|
+
* The `$route` service is typically used in conjunction with {@link ngRoute.directive:ngView ngView}
|
250
|
+
* directive and the {@link ngRoute.$routeParams $routeParams} service.
|
251
|
+
*
|
252
|
+
* @example
|
253
|
+
This example shows how changing the URL hash causes the `$route` to match a route against the
|
254
|
+
URL, and the `ngView` pulls in the partial.
|
255
|
+
|
256
|
+
Note that this example is using {@link ng.directive:script inlined templates}
|
257
|
+
to get it working on jsfiddle as well.
|
258
|
+
|
259
|
+
<example module="ngView" deps="angular-route.js">
|
260
|
+
<file name="index.html">
|
261
|
+
<div ng-controller="MainCntl">
|
262
|
+
Choose:
|
263
|
+
<a href="Book/Moby">Moby</a> |
|
264
|
+
<a href="Book/Moby/ch/1">Moby: Ch1</a> |
|
265
|
+
<a href="Book/Gatsby">Gatsby</a> |
|
266
|
+
<a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
|
267
|
+
<a href="Book/Scarlet">Scarlet Letter</a><br/>
|
268
|
+
|
269
|
+
<div ng-view></div>
|
270
|
+
<hr />
|
271
|
+
|
272
|
+
<pre>$location.path() = {{$location.path()}}</pre>
|
273
|
+
<pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
|
274
|
+
<pre>$route.current.params = {{$route.current.params}}</pre>
|
275
|
+
<pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
|
276
|
+
<pre>$routeParams = {{$routeParams}}</pre>
|
277
|
+
</div>
|
278
|
+
</file>
|
279
|
+
|
280
|
+
<file name="book.html">
|
281
|
+
controller: {{name}}<br />
|
282
|
+
Book Id: {{params.bookId}}<br />
|
283
|
+
</file>
|
284
|
+
|
285
|
+
<file name="chapter.html">
|
286
|
+
controller: {{name}}<br />
|
287
|
+
Book Id: {{params.bookId}}<br />
|
288
|
+
Chapter Id: {{params.chapterId}}
|
289
|
+
</file>
|
290
|
+
|
291
|
+
<file name="script.js">
|
292
|
+
angular.module('ngView', ['ngRoute']).config(function($routeProvider, $locationProvider) {
|
293
|
+
$routeProvider.when('/Book/:bookId', {
|
294
|
+
templateUrl: 'book.html',
|
295
|
+
controller: BookCntl,
|
296
|
+
resolve: {
|
297
|
+
// I will cause a 1 second delay
|
298
|
+
delay: function($q, $timeout) {
|
299
|
+
var delay = $q.defer();
|
300
|
+
$timeout(delay.resolve, 1000);
|
301
|
+
return delay.promise;
|
302
|
+
}
|
303
|
+
}
|
304
|
+
});
|
305
|
+
$routeProvider.when('/Book/:bookId/ch/:chapterId', {
|
306
|
+
templateUrl: 'chapter.html',
|
307
|
+
controller: ChapterCntl
|
308
|
+
});
|
309
|
+
|
310
|
+
// configure html5 to get links working on jsfiddle
|
311
|
+
$locationProvider.html5Mode(true);
|
312
|
+
});
|
313
|
+
|
314
|
+
function MainCntl($scope, $route, $routeParams, $location) {
|
315
|
+
$scope.$route = $route;
|
316
|
+
$scope.$location = $location;
|
317
|
+
$scope.$routeParams = $routeParams;
|
318
|
+
}
|
319
|
+
|
320
|
+
function BookCntl($scope, $routeParams) {
|
321
|
+
$scope.name = "BookCntl";
|
322
|
+
$scope.params = $routeParams;
|
323
|
+
}
|
324
|
+
|
325
|
+
function ChapterCntl($scope, $routeParams) {
|
326
|
+
$scope.name = "ChapterCntl";
|
327
|
+
$scope.params = $routeParams;
|
328
|
+
}
|
329
|
+
</file>
|
330
|
+
|
331
|
+
<file name="scenario.js">
|
332
|
+
it('should load and compile correct template', function() {
|
333
|
+
element('a:contains("Moby: Ch1")').click();
|
334
|
+
var content = element('.doc-example-live [ng-view]').text();
|
335
|
+
expect(content).toMatch(/controller\: ChapterCntl/);
|
336
|
+
expect(content).toMatch(/Book Id\: Moby/);
|
337
|
+
expect(content).toMatch(/Chapter Id\: 1/);
|
338
|
+
|
339
|
+
element('a:contains("Scarlet")').click();
|
340
|
+
sleep(2); // promises are not part of scenario waiting
|
341
|
+
content = element('.doc-example-live [ng-view]').text();
|
342
|
+
expect(content).toMatch(/controller\: BookCntl/);
|
343
|
+
expect(content).toMatch(/Book Id\: Scarlet/);
|
344
|
+
});
|
345
|
+
</file>
|
346
|
+
</example>
|
347
|
+
*/
|
348
|
+
|
349
|
+
/**
|
350
|
+
* @ngdoc event
|
351
|
+
* @name ngRoute.$route#$routeChangeStart
|
352
|
+
* @eventOf ngRoute.$route
|
353
|
+
* @eventType broadcast on root scope
|
354
|
+
* @description
|
355
|
+
* Broadcasted before a route change. At this point the route services starts
|
356
|
+
* resolving all of the dependencies needed for the route change to occurs.
|
357
|
+
* Typically this involves fetching the view template as well as any dependencies
|
358
|
+
* defined in `resolve` route property. Once all of the dependencies are resolved
|
359
|
+
* `$routeChangeSuccess` is fired.
|
360
|
+
*
|
361
|
+
* @param {Route} next Future route information.
|
362
|
+
* @param {Route} current Current route information.
|
363
|
+
*/
|
364
|
+
|
365
|
+
/**
|
366
|
+
* @ngdoc event
|
367
|
+
* @name ngRoute.$route#$routeChangeSuccess
|
368
|
+
* @eventOf ngRoute.$route
|
369
|
+
* @eventType broadcast on root scope
|
370
|
+
* @description
|
371
|
+
* Broadcasted after a route dependencies are resolved.
|
372
|
+
* {@link ngRoute.directive:ngView ngView} listens for the directive
|
373
|
+
* to instantiate the controller and render the view.
|
374
|
+
*
|
375
|
+
* @param {Object} angularEvent Synthetic event object.
|
376
|
+
* @param {Route} current Current route information.
|
377
|
+
* @param {Route|Undefined} previous Previous route information, or undefined if current is first route entered.
|
378
|
+
*/
|
379
|
+
|
380
|
+
/**
|
381
|
+
* @ngdoc event
|
382
|
+
* @name ngRoute.$route#$routeChangeError
|
383
|
+
* @eventOf ngRoute.$route
|
384
|
+
* @eventType broadcast on root scope
|
385
|
+
* @description
|
386
|
+
* Broadcasted if any of the resolve promises are rejected.
|
387
|
+
*
|
388
|
+
* @param {Route} current Current route information.
|
389
|
+
* @param {Route} previous Previous route information.
|
390
|
+
* @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.
|
391
|
+
*/
|
392
|
+
|
393
|
+
/**
|
394
|
+
* @ngdoc event
|
395
|
+
* @name ngRoute.$route#$routeUpdate
|
396
|
+
* @eventOf ngRoute.$route
|
397
|
+
* @eventType broadcast on root scope
|
398
|
+
* @description
|
399
|
+
*
|
400
|
+
* The `reloadOnSearch` property has been set to false, and we are reusing the same
|
401
|
+
* instance of the Controller.
|
402
|
+
*/
|
403
|
+
|
404
|
+
var forceReload = false,
|
405
|
+
$route = {
|
406
|
+
routes: routes,
|
407
|
+
|
408
|
+
/**
|
409
|
+
* @ngdoc method
|
410
|
+
* @name ngRoute.$route#reload
|
411
|
+
* @methodOf ngRoute.$route
|
412
|
+
*
|
413
|
+
* @description
|
414
|
+
* Causes `$route` service to reload the current route even if
|
415
|
+
* {@link ng.$location $location} hasn't changed.
|
416
|
+
*
|
417
|
+
* As a result of that, {@link ngRoute.directive:ngView ngView}
|
418
|
+
* creates new scope, reinstantiates the controller.
|
419
|
+
*/
|
420
|
+
reload: function() {
|
421
|
+
forceReload = true;
|
422
|
+
$rootScope.$evalAsync(updateRoute);
|
423
|
+
}
|
424
|
+
};
|
425
|
+
|
426
|
+
$rootScope.$on('$locationChangeSuccess', updateRoute);
|
427
|
+
|
428
|
+
return $route;
|
429
|
+
|
430
|
+
/////////////////////////////////////////////////////
|
431
|
+
|
432
|
+
/**
|
433
|
+
* @param on {string} current url
|
434
|
+
* @param route {Object} route regexp to match the url against
|
435
|
+
* @return {?Object}
|
436
|
+
*
|
437
|
+
* @description
|
438
|
+
* Check if the route matches the current url.
|
439
|
+
*
|
440
|
+
* Inspired by match in
|
441
|
+
* visionmedia/express/lib/router/router.js.
|
442
|
+
*/
|
443
|
+
function switchRouteMatcher(on, route) {
|
444
|
+
var keys = route.keys,
|
445
|
+
params = {};
|
446
|
+
|
447
|
+
if (!route.regexp) return null;
|
448
|
+
|
449
|
+
var m = route.regexp.exec(on);
|
450
|
+
if (!m) return null;
|
451
|
+
|
452
|
+
var N = 0;
|
453
|
+
for (var i = 1, len = m.length; i < len; ++i) {
|
454
|
+
var key = keys[i - 1];
|
455
|
+
|
456
|
+
var val = 'string' == typeof m[i]
|
457
|
+
? decodeURIComponent(m[i])
|
458
|
+
: m[i];
|
459
|
+
|
460
|
+
if (key && val) {
|
461
|
+
params[key.name] = val;
|
462
|
+
}
|
463
|
+
}
|
464
|
+
return params;
|
465
|
+
}
|
466
|
+
|
467
|
+
function updateRoute() {
|
468
|
+
var next = parseRoute(),
|
469
|
+
last = $route.current;
|
470
|
+
|
471
|
+
if (next && last && next.$$route === last.$$route
|
472
|
+
&& equals(next.pathParams, last.pathParams) && !next.reloadOnSearch && !forceReload) {
|
473
|
+
last.params = next.params;
|
474
|
+
copy(last.params, $routeParams);
|
475
|
+
$rootScope.$broadcast('$routeUpdate', last);
|
476
|
+
} else if (next || last) {
|
477
|
+
forceReload = false;
|
478
|
+
$rootScope.$broadcast('$routeChangeStart', next, last);
|
479
|
+
$route.current = next;
|
480
|
+
if (next) {
|
481
|
+
if (next.redirectTo) {
|
482
|
+
if (isString(next.redirectTo)) {
|
483
|
+
$location.path(interpolate(next.redirectTo, next.params)).search(next.params)
|
484
|
+
.replace();
|
485
|
+
} else {
|
486
|
+
$location.url(next.redirectTo(next.pathParams, $location.path(), $location.search()))
|
487
|
+
.replace();
|
488
|
+
}
|
489
|
+
}
|
490
|
+
}
|
491
|
+
|
492
|
+
$q.when(next).
|
493
|
+
then(function() {
|
494
|
+
if (next) {
|
495
|
+
var locals = extend({}, next.resolve),
|
496
|
+
template, templateUrl;
|
497
|
+
|
498
|
+
forEach(locals, function(value, key) {
|
499
|
+
locals[key] = isString(value) ? $injector.get(value) : $injector.invoke(value);
|
500
|
+
});
|
501
|
+
|
502
|
+
if (isDefined(template = next.template)) {
|
503
|
+
if (isFunction(template)) {
|
504
|
+
template = template(next.params);
|
505
|
+
}
|
506
|
+
} else if (isDefined(templateUrl = next.templateUrl)) {
|
507
|
+
if (isFunction(templateUrl)) {
|
508
|
+
templateUrl = templateUrl(next.params);
|
509
|
+
}
|
510
|
+
templateUrl = $sce.getTrustedResourceUrl(templateUrl);
|
511
|
+
if (isDefined(templateUrl)) {
|
512
|
+
next.loadedTemplateUrl = templateUrl;
|
513
|
+
template = $http.get(templateUrl, {cache: $templateCache}).
|
514
|
+
then(function(response) { return response.data; });
|
515
|
+
}
|
516
|
+
}
|
517
|
+
if (isDefined(template)) {
|
518
|
+
locals['$template'] = template;
|
519
|
+
}
|
520
|
+
return $q.all(locals);
|
521
|
+
}
|
522
|
+
}).
|
523
|
+
// after route change
|
524
|
+
then(function(locals) {
|
525
|
+
if (next == $route.current) {
|
526
|
+
if (next) {
|
527
|
+
next.locals = locals;
|
528
|
+
copy(next.params, $routeParams);
|
529
|
+
}
|
530
|
+
$rootScope.$broadcast('$routeChangeSuccess', next, last);
|
531
|
+
}
|
532
|
+
}, function(error) {
|
533
|
+
if (next == $route.current) {
|
534
|
+
$rootScope.$broadcast('$routeChangeError', next, last, error);
|
535
|
+
}
|
536
|
+
});
|
537
|
+
}
|
538
|
+
}
|
539
|
+
|
540
|
+
|
541
|
+
/**
|
542
|
+
* @returns the current active route, by matching it against the URL
|
543
|
+
*/
|
544
|
+
function parseRoute() {
|
545
|
+
// Match a route
|
546
|
+
var params, match;
|
547
|
+
forEach(routes, function(route, path) {
|
548
|
+
if (!match && (params = switchRouteMatcher($location.path(), route))) {
|
549
|
+
match = inherit(route, {
|
550
|
+
params: extend({}, $location.search(), params),
|
551
|
+
pathParams: params});
|
552
|
+
match.$$route = route;
|
553
|
+
}
|
554
|
+
});
|
555
|
+
// No route matched; fallback to "otherwise" route
|
556
|
+
return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});
|
557
|
+
}
|
558
|
+
|
559
|
+
/**
|
560
|
+
* @returns interpolation of the redirect path with the parameters
|
561
|
+
*/
|
562
|
+
function interpolate(string, params) {
|
563
|
+
var result = [];
|
564
|
+
forEach((string||'').split(':'), function(segment, i) {
|
565
|
+
if (i == 0) {
|
566
|
+
result.push(segment);
|
567
|
+
} else {
|
568
|
+
var segmentMatch = segment.match(/(\w+)(.*)/);
|
569
|
+
var key = segmentMatch[1];
|
570
|
+
result.push(params[key]);
|
571
|
+
result.push(segmentMatch[2] || '');
|
572
|
+
delete params[key];
|
573
|
+
}
|
574
|
+
});
|
575
|
+
return result.join('');
|
576
|
+
}
|
577
|
+
}];
|
578
|
+
}
|
579
|
+
|
580
|
+
ngRouteModule.provider('$routeParams', $RouteParamsProvider);
|
581
|
+
|
582
|
+
|
583
|
+
/**
|
584
|
+
* @ngdoc object
|
585
|
+
* @name ngRoute.$routeParams
|
586
|
+
* @requires $route
|
587
|
+
*
|
588
|
+
* @description
|
589
|
+
* Current set of route parameters. The route parameters are a combination of the
|
590
|
+
* {@link ng.$location $location} `search()`, and `path()`. The `path` parameters
|
591
|
+
* are extracted when the {@link ngRoute.$route $route} path is matched.
|
592
|
+
*
|
593
|
+
* In case of parameter name collision, `path` params take precedence over `search` params.
|
594
|
+
*
|
595
|
+
* The service guarantees that the identity of the `$routeParams` object will remain unchanged
|
596
|
+
* (but its properties will likely change) even when a route change occurs.
|
597
|
+
*
|
598
|
+
* Note that the `$routeParams` are only updated *after* a route change completes successfully.
|
599
|
+
* This means that you cannot rely on `$routeParams` being correct in route resolve functions.
|
600
|
+
* Instead you can use `$route.current.params` to access the new route's parameters.
|
601
|
+
*
|
602
|
+
* @example
|
603
|
+
* <pre>
|
604
|
+
* // Given:
|
605
|
+
* // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
|
606
|
+
* // Route: /Chapter/:chapterId/Section/:sectionId
|
607
|
+
* //
|
608
|
+
* // Then
|
609
|
+
* $routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
|
610
|
+
* </pre>
|
611
|
+
*/
|
612
|
+
function $RouteParamsProvider() {
|
613
|
+
this.$get = function() { return {}; };
|
614
|
+
}
|
615
|
+
|
616
|
+
/**
|
617
|
+
* @ngdoc directive
|
618
|
+
* @name ngRoute.directive:ngView
|
619
|
+
* @restrict ECA
|
620
|
+
*
|
621
|
+
* @description
|
622
|
+
* # Overview
|
623
|
+
* `ngView` is a directive that complements the {@link ngRoute.$route $route} service by
|
624
|
+
* including the rendered template of the current route into the main layout (`index.html`) file.
|
625
|
+
* Every time the current route changes, the included view changes with it according to the
|
626
|
+
* configuration of the `$route` service.
|
627
|
+
*
|
628
|
+
* @animations
|
629
|
+
* enter - animation is used to bring new content into the browser.
|
630
|
+
* leave - animation is used to animate existing content away.
|
631
|
+
*
|
632
|
+
* The enter and leave animation occur concurrently.
|
633
|
+
*
|
634
|
+
* @scope
|
635
|
+
* @example
|
636
|
+
<example module="ngViewExample" deps="angular-route.js" animations="true">
|
637
|
+
<file name="index.html">
|
638
|
+
<div ng-controller="MainCntl as main">
|
639
|
+
Choose:
|
640
|
+
<a href="Book/Moby">Moby</a> |
|
641
|
+
<a href="Book/Moby/ch/1">Moby: Ch1</a> |
|
642
|
+
<a href="Book/Gatsby">Gatsby</a> |
|
643
|
+
<a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
|
644
|
+
<a href="Book/Scarlet">Scarlet Letter</a><br/>
|
645
|
+
|
646
|
+
<div class="example-animate-container">
|
647
|
+
<div ng-view class="view-example"></div>
|
648
|
+
</div>
|
649
|
+
<hr />
|
650
|
+
|
651
|
+
<pre>$location.path() = {{main.$location.path()}}</pre>
|
652
|
+
<pre>$route.current.templateUrl = {{main.$route.current.templateUrl}}</pre>
|
653
|
+
<pre>$route.current.params = {{main.$route.current.params}}</pre>
|
654
|
+
<pre>$route.current.scope.name = {{main.$route.current.scope.name}}</pre>
|
655
|
+
<pre>$routeParams = {{main.$routeParams}}</pre>
|
656
|
+
</div>
|
657
|
+
</file>
|
658
|
+
|
659
|
+
<file name="book.html">
|
660
|
+
<div>
|
661
|
+
controller: {{book.name}}<br />
|
662
|
+
Book Id: {{book.params.bookId}}<br />
|
663
|
+
</div>
|
664
|
+
</file>
|
665
|
+
|
666
|
+
<file name="chapter.html">
|
667
|
+
<div>
|
668
|
+
controller: {{chapter.name}}<br />
|
669
|
+
Book Id: {{chapter.params.bookId}}<br />
|
670
|
+
Chapter Id: {{chapter.params.chapterId}}
|
671
|
+
</div>
|
672
|
+
</file>
|
673
|
+
|
674
|
+
<file name="animations.css">
|
675
|
+
.example-animate-container {
|
676
|
+
position:relative;
|
677
|
+
background:white;
|
678
|
+
border:1px solid black;
|
679
|
+
height:40px;
|
680
|
+
overflow:hidden;
|
681
|
+
}
|
682
|
+
|
683
|
+
.example-animate-container > div {
|
684
|
+
padding:10px;
|
685
|
+
}
|
686
|
+
|
687
|
+
.view-example.ng-enter, .view-example.ng-leave {
|
688
|
+
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
|
689
|
+
-moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
|
690
|
+
-o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
|
691
|
+
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
|
692
|
+
|
693
|
+
display:block;
|
694
|
+
width:100%;
|
695
|
+
border-left:1px solid black;
|
696
|
+
|
697
|
+
position:absolute;
|
698
|
+
top:0;
|
699
|
+
left:0;
|
700
|
+
right:0;
|
701
|
+
bottom:0;
|
702
|
+
padding:10px;
|
703
|
+
}
|
704
|
+
|
705
|
+
.example-animate-container {
|
706
|
+
position:relative;
|
707
|
+
height:100px;
|
708
|
+
}
|
709
|
+
|
710
|
+
.view-example.ng-enter {
|
711
|
+
left:100%;
|
712
|
+
}
|
713
|
+
.view-example.ng-enter.ng-enter-active {
|
714
|
+
left:0;
|
715
|
+
}
|
716
|
+
|
717
|
+
.view-example.ng-leave { }
|
718
|
+
.view-example.ng-leave.ng-leave-active {
|
719
|
+
left:-100%;
|
720
|
+
}
|
721
|
+
</file>
|
722
|
+
|
723
|
+
<file name="script.js">
|
724
|
+
angular.module('ngViewExample', ['ngRoute', 'ngAnimate'], function($routeProvider, $locationProvider) {
|
725
|
+
$routeProvider.when('/Book/:bookId', {
|
726
|
+
templateUrl: 'book.html',
|
727
|
+
controller: BookCntl,
|
728
|
+
controllerAs: 'book'
|
729
|
+
});
|
730
|
+
$routeProvider.when('/Book/:bookId/ch/:chapterId', {
|
731
|
+
templateUrl: 'chapter.html',
|
732
|
+
controller: ChapterCntl,
|
733
|
+
controllerAs: 'chapter'
|
734
|
+
});
|
735
|
+
|
736
|
+
// configure html5 to get links working on jsfiddle
|
737
|
+
$locationProvider.html5Mode(true);
|
738
|
+
});
|
739
|
+
|
740
|
+
function MainCntl($route, $routeParams, $location) {
|
741
|
+
this.$route = $route;
|
742
|
+
this.$location = $location;
|
743
|
+
this.$routeParams = $routeParams;
|
744
|
+
}
|
745
|
+
|
746
|
+
function BookCntl($routeParams) {
|
747
|
+
this.name = "BookCntl";
|
748
|
+
this.params = $routeParams;
|
749
|
+
}
|
750
|
+
|
751
|
+
function ChapterCntl($routeParams) {
|
752
|
+
this.name = "ChapterCntl";
|
753
|
+
this.params = $routeParams;
|
754
|
+
}
|
755
|
+
</file>
|
756
|
+
|
757
|
+
<file name="scenario.js">
|
758
|
+
it('should load and compile correct template', function() {
|
759
|
+
element('a:contains("Moby: Ch1")').click();
|
760
|
+
var content = element('.doc-example-live [ng-view]').text();
|
761
|
+
expect(content).toMatch(/controller\: ChapterCntl/);
|
762
|
+
expect(content).toMatch(/Book Id\: Moby/);
|
763
|
+
expect(content).toMatch(/Chapter Id\: 1/);
|
764
|
+
|
765
|
+
element('a:contains("Scarlet")').click();
|
766
|
+
content = element('.doc-example-live [ng-view]').text();
|
767
|
+
expect(content).toMatch(/controller\: BookCntl/);
|
768
|
+
expect(content).toMatch(/Book Id\: Scarlet/);
|
769
|
+
});
|
770
|
+
</file>
|
771
|
+
</example>
|
772
|
+
*/
|
773
|
+
|
774
|
+
|
775
|
+
/**
|
776
|
+
* @ngdoc event
|
777
|
+
* @name ngRoute.directive:ngView#$viewContentLoaded
|
778
|
+
* @eventOf ngRoute.directive:ngView
|
779
|
+
* @eventType emit on the current ngView scope
|
780
|
+
* @description
|
781
|
+
* Emitted every time the ngView content is reloaded.
|
782
|
+
*/
|
783
|
+
var NG_VIEW_PRIORITY = 500;
|
784
|
+
var ngViewDirective = ['$route', '$anchorScroll', '$compile', '$controller', '$animate',
|
785
|
+
function($route, $anchorScroll, $compile, $controller, $animate) {
|
786
|
+
return {
|
787
|
+
restrict: 'ECA',
|
788
|
+
terminal: true,
|
789
|
+
priority: NG_VIEW_PRIORITY,
|
790
|
+
compile: function(element, attr) {
|
791
|
+
var onloadExp = attr.onload || '';
|
792
|
+
|
793
|
+
element.html('');
|
794
|
+
var anchor = jqLite(document.createComment(' ngView '));
|
795
|
+
element.replaceWith(anchor);
|
796
|
+
|
797
|
+
return function(scope) {
|
798
|
+
var currentScope, currentElement;
|
799
|
+
|
800
|
+
scope.$on('$routeChangeSuccess', update);
|
801
|
+
update();
|
802
|
+
|
803
|
+
function cleanupLastView() {
|
804
|
+
if (currentScope) {
|
805
|
+
currentScope.$destroy();
|
806
|
+
currentScope = null;
|
807
|
+
}
|
808
|
+
if(currentElement) {
|
809
|
+
$animate.leave(currentElement);
|
810
|
+
currentElement = null;
|
811
|
+
}
|
812
|
+
}
|
813
|
+
|
814
|
+
function update() {
|
815
|
+
var locals = $route.current && $route.current.locals,
|
816
|
+
template = locals && locals.$template;
|
817
|
+
|
818
|
+
if (template) {
|
819
|
+
cleanupLastView();
|
820
|
+
|
821
|
+
currentScope = scope.$new();
|
822
|
+
currentElement = element.clone();
|
823
|
+
currentElement.html(template);
|
824
|
+
$animate.enter(currentElement, null, anchor);
|
825
|
+
|
826
|
+
var link = $compile(currentElement, false, NG_VIEW_PRIORITY - 1),
|
827
|
+
current = $route.current;
|
828
|
+
|
829
|
+
if (current.controller) {
|
830
|
+
locals.$scope = currentScope;
|
831
|
+
var controller = $controller(current.controller, locals);
|
832
|
+
if (current.controllerAs) {
|
833
|
+
currentScope[current.controllerAs] = controller;
|
834
|
+
}
|
835
|
+
currentElement.data('$ngControllerController', controller);
|
836
|
+
currentElement.children().data('$ngControllerController', controller);
|
837
|
+
}
|
838
|
+
|
839
|
+
current.scope = currentScope;
|
840
|
+
|
841
|
+
link(currentScope);
|
842
|
+
|
843
|
+
currentScope.$emit('$viewContentLoaded');
|
844
|
+
currentScope.$eval(onloadExp);
|
845
|
+
|
846
|
+
// $anchorScroll might listen on event...
|
847
|
+
$anchorScroll();
|
848
|
+
} else {
|
849
|
+
cleanupLastView();
|
850
|
+
}
|
851
|
+
}
|
852
|
+
}
|
853
|
+
}
|
854
|
+
};
|
855
|
+
}];
|
856
|
+
|
857
|
+
ngRouteModule.directive('ngView', ngViewDirective);
|
858
|
+
|
859
|
+
|
860
|
+
})(window, window.angular);
|