erikringsmuth/app-router

regular expression + data binding

Open

#27 aperta il 1 ott 2014

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)HTML (83 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (608 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

I think app-router could use regular expressions in order to match path variables. Regex with named captures would be great but Javascript doesn't support them natively (xregexp is a js library that support named captures). Even simple native capture groups (by index number) would be great.

An example:

<!-- url -->
http://www.example.com/demo/15

<!-- route, notice variables attribute  -->
<!-- first capure [word (\w+)], second capture [number (\d+)] -->
<app-route path="/^\/(\w+)\/(\d+)$/i" regex variables="word number" import="/pages/regex-page.html"></app-route>

<!-- data binding -->
<regex-page word="demo" number="15"></order-page>

It's much more powerful than actual path variable data binding (using semicollon like :pathArg1). Thank you for app-router.

Guida contributor