erikringsmuth/app-router

regular expression + data binding

Open

#27 创建于 2014年10月1日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)HTML (608 star) (83 fork)batch import
enhancementhelp wanted

描述

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.

贡献者指南