erikringsmuth / app-router

Router for Web Components
https://erikringsmuth.github.io/app-router/
MIT License
610 stars 83 forks source link

Ability to disable path & query param type casting #48

Closed OS-Chris closed 9 years ago

OS-Chris commented 9 years ago

I'm having dramas with path paramaters being automatically type casted.

In some instances, I'd prefer to know that I'm getting a string. If there was an option to disable the auto type casting, that'd be awesome.

erikringsmuth commented 9 years ago

Makes sense. This should be a really simple change. I'll add an option (attribute) to disable typecasting.

erikringsmuth commented 9 years ago

I'm working on a branch that will add typecast="auto|string" as an option on the router. It would look something like this.

<app-router typecast="string">
  <!-- customerId will be bound as "123" instead of the number 123 -->
  <app-route path="/customer/:customerId" import="/pages/customer-page.html"></app-route>
</app-router>

This would also leave strings alone and not unescape them.

I'm hoping to get one more set of changes in this weekend before bumping the version to 2.3.0.

erikringsmuth commented 9 years ago

I kept at it and got my other changes done. I bumped the version to 2.3.0 with this change and documented the typecast attribute here https://erikringsmuth.github.io/app-router/#/api#typecast.

OS-Chris commented 9 years ago

Legend. Thanks.