erikringsmuth/app-router

regular expression + data binding

Open

#27 opened on Oct 1, 2014

View on GitHub
 (1 comment) (0 reactions) (0 assignees)HTML (608 stars) (83 forks)batch import
enhancementhelp wanted

Description

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.

Contributor guide